summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2011-05-27 15:56:13 +0000
committerjilles <jilles@FreeBSD.org>2011-05-27 15:56:13 +0000
commit543f63b8dc758a4508506526535f62954136bc87 (patch)
treebb8a5ce42369db48f8daa5a5f00c3f734eebf451 /bin
parentb41dc3debc7c84bd2fac07d5b920c500658a9600 (diff)
downloadFreeBSD-src-543f63b8dc758a4508506526535f62954136bc87.zip
FreeBSD-src-543f63b8dc758a4508506526535f62954136bc87.tar.gz
sh: Fix unquoted $@/$* if IFS=''.
If IFS is null, unquoted $@/$* should still expand to separate words. This differs from quoted $@ (which does not depend on IFS) in that pathname generation is performed and empty words are removed.
Diffstat (limited to 'bin')
-rw-r--r--bin/sh/expand.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/bin/sh/expand.c b/bin/sh/expand.c
index b3c4962..108a77c 100644
--- a/bin/sh/expand.c
+++ b/bin/sh/expand.c
@@ -761,7 +761,8 @@ again: /* jump here after setting a variable with ${var=text} */
break;
record:
recordregion(startloc, expdest - stackblock(),
- varflags & VSQUOTE);
+ varflags & VSQUOTE || (ifsset() && ifsval()[0] == '\0' &&
+ (*var == '@' || *var == '*')));
break;
case VSPLUS:
@@ -947,7 +948,9 @@ numvar:
sep = ' ';
for (ap = shellparam.p ; (p = *ap++) != NULL ; ) {
strtodest(p, flag, subtype, quoted);
- if (*ap && sep)
+ if (!*ap)
+ break;
+ if (sep || (flag & EXP_FULL && !quoted && **ap != '\0'))
STPUTC(sep, expdest);
}
break;
OpenPOWER on IntegriCloud