Message ID | 3a7ba3fa786e34cde8ab158cb8578f0d39cf655e.1670979949.git.nabijaczleweli@nabijaczleweli.xyz (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Herbert Xu |
Headers | show |
Series | [v2,1/3] parser: fixredir: invalid redirections are run-time, not syntax | expand |
наб <nabijaczleweli@nabijaczleweli.xyz> wrote: > [-- text/plain, encoding quoted-printable, charset: us-ascii, 33 lines --] > > This fixes a long-standing bug where > echo 'echo >&a' | sh > errors out with > sh: 2: Syntax error: Bad fd number > despite the error being on line 1 > > This patch makes the error > sh: 1: Bad fd number: a > as expected > > Adapted-from: https://github.com/hvdijk/gwsh/commit/d279523041c1c380d64b6dec7760feba20bbf6b5 > --- > src/parser.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Patch applied. Thanks.
diff --git a/src/parser.c b/src/parser.c index a552c47..8a06b9e 100644 --- a/src/parser.c +++ b/src/parser.c @@ -615,7 +615,7 @@ void fixredir(union node *n, const char *text, int err) else { if (err) - synerror("Bad fd number"); + sh_error("Bad fd number: %s", text); else n->ndup.vname = makename(); }