Change delta encoding of list deletions
authorJo-Philipp Wich <jow@openwrt.org>
Mon, 22 Apr 2013 13:50:08 +0000 (15:50 +0200)
committerJo-Philipp Wich <jow@openwrt.org>
Mon, 22 Apr 2013 14:01:25 +0000 (16:01 +0200)
When encoding list_del commands in delta files, '_' is used as prefix but this
breaks any command operating on files starting with an underscore since the
command prefix becomes indistinguishable from the filename.

The regression was introduced with ec8cbbbe0f20e67cbd3bd471b9ac55ceacaef7b8.

Avoid this problem by using '~' as command prefix for list deletions.

delta.c

diff --git a/delta.c b/delta.c
index 1da3b75fca6f8607c9fd5d35ec9ed79bb0ea2cc1..a041f541dcc404986a677e9bd4976ebdefecdac7 100644 (file)
--- a/delta.c
+++ b/delta.c
@@ -114,7 +114,7 @@ static inline int uci_parse_delta_tuple(struct uci_context *ctx, char **buf, str
        case '|':
                c = UCI_CMD_LIST_ADD;
                break;
-       case '_':
+       case '~':
                c = UCI_CMD_LIST_DEL;
                break;
        }
@@ -459,7 +459,7 @@ int uci_save(struct uci_context *ctx, struct uci_package *p)
                        prefix = "|";
                        break;
                case UCI_CMD_LIST_DEL:
-                       prefix = "_";
+                       prefix = "~";
                        break;
                default:
                        break;