aboutsummaryrefslogtreecommitdiff
path: root/shell/ash.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2017-07-05 22:19:28 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2017-07-05 22:19:28 +0200
commit4142f0187dcf8454e8d2a8d16b321dbd573c170e (patch)
tree88fca8c1cc9b6b213160d386c66ede7026bf7c08 /shell/ash.c
parented79a636238ec15c562862787dd71cd9de168b7d (diff)
downloadbusybox-w32-4142f0187dcf8454e8d2a8d16b321dbd573c170e.tar.gz
busybox-w32-4142f0187dcf8454e8d2a8d16b321dbd573c170e.tar.bz2
busybox-w32-4142f0187dcf8454e8d2a8d16b321dbd573c170e.zip
ash: fix escaping of a few characters (broken by last commits)
Add a testcase which tests all ASCII punctuation escapes. NB: hush is failing this test! Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/ash.c')
-rw-r--r--shell/ash.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 9b1f57949..946e8726e 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -5939,12 +5939,17 @@ rmescapes(char *str, int flag)
5939 * (for example, glibc <= 2.22). 5939 * (for example, glibc <= 2.22).
5940 * 5940 *
5941 * Lets add "\" only on the chars which need it. 5941 * Lets add "\" only on the chars which need it.
5942 * Testcases for less obvious chars are shown.
5942 */ 5943 */
5943 if (*p == '*' 5944 if (*p == '*'
5944 || *p == '?' 5945 || *p == '?'
5945 || *p == '[' 5946 || *p == '['
5946 /* || *p == ']' maybe also this? */ 5947 || *p == '\\' /* case '\' in \\ ) echo ok;; *) echo WRONG;; esac */
5947 || *p == '\\' 5948 || *p == ']' /* case ']' in [a\]] ) echo ok;; *) echo WRONG;; esac */
5949 || *p == '-' /* case '-' in [a\-c]) echo ok;; *) echo WRONG;; esac */
5950 || *p == '!' /* case '!' in [\!] ) echo ok;; *) echo WRONG;; esac */
5951 /* Some libc support [^negate], that's why "^" also needs love */
5952 || *p == '^' /* case '^' in [\^] ) echo ok;; *) echo WRONG;; esac */
5948 ) { 5953 ) {
5949 *q++ = '\\'; 5954 *q++ = '\\';
5950 } 5955 }