summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2025-08-11 18:43:02 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2025-08-11 18:43:02 +0200
commit1cd53c15a2b370487c7951345efff3b43f228d1d (patch)
tree6d289da6be4dcbb1d5fb00c74e1f4ad01ec276aa
parent0da6c813e13eaf1cddfd7cbee1f3a5a4ffe58ec0 (diff)
ash: parser: Invalid redirections are run-time, not syntax errors
Upstream commit Date: Wed, 14 Dec 2022 02:06:05 +0100 parser: Invalid redirections are run-time, not syntax errors 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 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--shell/ash.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/shell/ash.c b/shell/ash.c
index ad1b9fd9f..7a4f7c6a8 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -12163,7 +12163,7 @@ fixredir(union node *n, const char *text, int err)
* silently truncate results to word width.
*/
if (err)
- raise_error_syntax("bad fd number");
+ ash_msg_and_raise_error("bad fd number");
n->ndup.vname = makename();
}
}