From 1cd53c15a2b370487c7951345efff3b43f228d1d Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 11 Aug 2025 18:43:02 +0200 Subject: 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 --- shell/ash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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(); } } -- cgit v1.2.3