Message ID | m2y33ftyu7.fsf@pomona.edu (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Herbert Xu |
Headers | show |
Series | alias: Fix handling of empty aliases | expand |
Op 09-05-19 om 16:46 schreef Michael Greenberg:
> Dash was incorrectly handling empty aliases.
For the record, the behaviour in Busybox ash, FreeBSD sh and NetBSD sh
is the same.
- M.
diff --git a/src/parser.c b/src/parser.c index 1f9e8ec..a1d6116 100644 --- a/src/parser.c +++ b/src/parser.c @@ -470,6 +470,7 @@ next_case: break; case TWORD: case TREDIR: + case TNL: /* necessary for empty aliases */ tokpushback++; return simplecmd(); } @@ -717,6 +718,7 @@ top: } } +ignorenl: /* empty alias? */ if (t != TWORD || quoteflag) { goto out; } @@ -739,8 +741,11 @@ top: if ((ap = lookupalias(wordtext, 1)) != NULL) { if (*ap->val) { pushstring(ap->val, ap); + goto top; + } else { + t = xxreadtoken(); + goto ignorenl; } - goto top; } } out: