[git commit] libbb/lineedit: do not escape %^=+}]:, escape ~? in tab completion
Denys Vlasenko
vda.linux at googlemail.com
Fri Sep 17 15:33:32 UTC 2021
commit: https://git.busybox.net/busybox/commit/?id=6d2463ac01dd88cc4359ebbeae9cd757ce037c2b
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master
function old new delta
.rodata 104185 104180 -5
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
libbb/lineedit.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
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)
static const char *is_special_char(char c)
{
- return strchr(" `\"#$%^&*()=+{}[]:;'|\\<>", c);
+ // {: It's mandatory to escape { only if entire name is "{"
+ // (otherwise it's not special. Example: file named "{ "
+ // can be escaped simply as "{\ "; "{a" or "a{" need no escaping),
+ // or if shell supports brace expansion
+ // (ash doesn't, hush optionally does).
+ // (): unlike {, shell treats () specially even in contexts
+ // where they clearly are not valid (e.g. "echo )" is an error).
+ // #: needs escaping to not start a shell comment.
+ return strchr(" `'\"\\#$~?*[{()&;|<>", c);
+ // Used to also have %^=+}]: but not necessary to escape?
}
static char *quote_special_chars(char *found)
More information about the busybox-cvs
mailing list