diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2021-09-17 17:32:30 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2021-09-17 17:33:32 +0200 |
commit | 6d2463ac01dd88cc4359ebbeae9cd757ce037c2b (patch) | |
tree | 4d204f224635c13193213ab8e38cb15b209ea342 | |
parent | 6279aec03d4677424408a515a57aa83664b81311 (diff) | |
download | busybox-w32-6d2463ac01dd88cc4359ebbeae9cd757ce037c2b.tar.gz busybox-w32-6d2463ac01dd88cc4359ebbeae9cd757ce037c2b.tar.bz2 busybox-w32-6d2463ac01dd88cc4359ebbeae9cd757ce037c2b.zip |
libbb/lineedit: do not escape %^=+}]:, escape ~? in tab completion
function old new delta
.rodata 104185 104180 -5
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | libbb/lineedit.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/libbb/lineedit.c b/libbb/lineedit.c index 68d19e127..e8d721e61 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c | |||
@@ -1133,7 +1133,16 @@ static void showfiles(void) | |||
1133 | 1133 | ||
1134 | static const char *is_special_char(char c) | 1134 | static const char *is_special_char(char c) |
1135 | { | 1135 | { |
1136 | return strchr(" `\"#$%^&*()=+{}[]:;'|\\<>", c); | 1136 | // {: It's mandatory to escape { only if entire name is "{" |
1137 | // (otherwise it's not special. Example: file named "{ " | ||
1138 | // can be escaped simply as "{\ "; "{a" or "a{" need no escaping), | ||
1139 | // or if shell supports brace expansion | ||
1140 | // (ash doesn't, hush optionally does). | ||
1141 | // (): unlike {, shell treats () specially even in contexts | ||
1142 | // where they clearly are not valid (e.g. "echo )" is an error). | ||
1143 | // #: needs escaping to not start a shell comment. | ||
1144 | return strchr(" `'\"\\#$~?*[{()&;|<>", c); | ||
1145 | // Used to also have %^=+}]: but not necessary to escape? | ||
1137 | } | 1146 | } |
1138 | 1147 | ||
1139 | static char *quote_special_chars(char *found) | 1148 | static char *quote_special_chars(char *found) |