aboutsummaryrefslogtreecommitdiff
path: root/toys/pending
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2020-04-04 10:50:26 -0500
committerRob Landley <rob@landley.net>2020-04-04 10:50:26 -0500
commitec6ab53515d2a1858a8cbb605b6e654970f9484f (patch)
tree62ed020cfce314486522789f33828dcb8e3684fe /toys/pending
parentf79dc0cfb2ea534876c776684ec1f1a0a53078c6 (diff)
downloadtoybox-ec6ab53515d2a1858a8cbb605b6e654970f9484f.tar.gz
Fix lifetime rules in bracket expansion.
Diffstat (limited to 'toys/pending')
-rw-r--r--toys/pending/sh.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/toys/pending/sh.c b/toys/pending/sh.c
index 9b116a73..e09fe3e8 100644
--- a/toys/pending/sh.c
+++ b/toys/pending/sh.c
@@ -796,7 +796,6 @@ static char *merge_args(char *pre, int argc, char *argv[], char *sep,
#define NO_TILDE (1<<3) // ~username/path
#define NO_QUOTE (1<<4) // quote removal
#define FORCE_COPY (1<<31) // don't keep original, copy even if not modified
-#define FORCE_KEEP (1<<30) // this is a copy, free if not appended to delete
// TODO: parameter/variable $(command) $((math)) split pathglob
// TODO: ${name:?error} causes an error/abort here (syntax_err longjmp?)
// TODO: $1 $@ $* need args marshalled down here: function+structure?
@@ -812,7 +811,6 @@ static void expand_arg_nobrace(struct sh_arg *arg, char *str, unsigned flags,
int at = 0, ii = 0, dd, jj, kk, ll, oo = 0;
if (BUGBUG) dprintf(255, "expand %s\n", str);
- if (flags&FORCE_KEEP) old = 0;
// TODO ls -l /proc/$$/fd
@@ -1134,7 +1132,8 @@ static void expand_arg(struct sh_arg *arg, char *old, unsigned flags,
}
// Save result
- expand_arg_nobrace(arg, ss, flags|FORCE_KEEP, delete);
+ add_arg(delete, ss);
+ expand_arg_nobrace(arg, ss, flags, delete);
// increment
for (bb = blist->prev; bb; bb = (bb == blist) ? 0 : bb->prev) {