summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko2017-07-25 17:37:57 +0200
committerDenys Vlasenko2017-07-25 17:37:57 +0200
commit2990aa45d188b1d9814c89dd44658f068eb37e83 (patch)
treedfb8db4baf8b3e0012bc7665c60db78c73ef7e77
parentb28d4c3462e6b0e66322503f5ef0b941e0bb9cb8 (diff)
downloadbusybox-2990aa45d188b1d9814c89dd44658f068eb37e83.zip
busybox-2990aa45d188b1d9814c89dd44658f068eb37e83.tar.gz
ash: sync up with dash with respect to redirection escaping
We fixed the problem differently than they. Let's not deviate. Upstream commit: Date: Thu, 27 May 2010 20:07:29 +1000 [EXPAND] Fix corruption of redirections with byte 0x81 In other ash variants, a partial implementation of ksh-like cmd >file* adds and removes CTLESC bytes ('\x81') in redirection filenames, preserving 8-bit transparency. Long ago, dash removed the code to add the CTLESC bytes, but not the code to remove them, causing corruption of filenames containing CTLESC. This commit removes the code to remove the CTLESC bytes. The CTLESC byte occurs frequently in UTF-8 encoded non-Latin text. This bug has been reported various times to Ubuntu and Debian (e.g. Launchpad Ubuntu #422298). This patch is the same as the one submitted by Alexander Korolkov in Ubuntu #422298. Signed-off-by: Jilles Tjoelker <jilles@stack.nl> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> function old new delta changepath 194 192 -2 expandarg 1000 984 -16 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-18) Total: -18 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--shell/ash.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 72ceba7..c353834 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -5711,7 +5711,7 @@ ash_arith(const char *s)
#define RMESCAPE_SLASH 0x20 /* Stop globbing after slash */
/* Add CTLESC when necessary. */
-#define QUOTES_ESC (EXP_FULL | EXP_CASE | EXP_QPAT | EXP_REDIR)
+#define QUOTES_ESC (EXP_FULL | EXP_CASE | EXP_QPAT)
/* Do not skip NUL characters. */
#define QUOTES_KEEPNUL EXP_TILDE
@@ -7608,10 +7608,6 @@ expandarg(union node *arg, struct arglist *arglist, int flag)
exparg.lastp = &exparg.list;
expandmeta(exparg.list /*, flag*/);
} else {
- if (flag & EXP_REDIR) { /*XXX - for now, just remove escapes */
- rmescapes(p, 0);
- TRACE(("expandarg: rmescapes:'%s'\n", p));
- }
sp = stzalloc(sizeof(*sp));
sp->text = p;
*exparg.lastp = sp;