From 9ee5892798be81f7a6f3e070ecd52cbf0d55740e Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 17 Feb 2020 10:24:32 +0100 Subject: ash: expand: Fix trailing newlines processing in backquote expanding Upstream commit: Date: Mon, 29 Apr 2019 19:13:37 +0500 expand: Fix trailing newlines processing in backquote expanding According to POSIX.1-2008 we should remove newlines only at the end of the substitution. Newlines-only substitions causes dash to remove newlines before beggining of the substitution. The following code: cat <2" instead of expected "12". This patch fixes trailing newlines processing in backquote expanding. Signed-off-by: Nikolai Merinov Signed-off-by: Herbert Xu Signed-off-by: Denys Vlasenko --- shell/hush_test/hush-psubst/tick_in_heredoc.right | 5 +++++ shell/hush_test/hush-psubst/tick_in_heredoc.tests | 7 +++++++ 2 files changed, 12 insertions(+) create mode 100644 shell/hush_test/hush-psubst/tick_in_heredoc.right create mode 100755 shell/hush_test/hush-psubst/tick_in_heredoc.tests (limited to 'shell/hush_test/hush-psubst') diff --git a/shell/hush_test/hush-psubst/tick_in_heredoc.right b/shell/hush_test/hush-psubst/tick_in_heredoc.right new file mode 100644 index 0000000..7e7bac6 --- /dev/null +++ b/shell/hush_test/hush-psubst/tick_in_heredoc.right @@ -0,0 +1,5 @@ +1 + +2 + +3 diff --git a/shell/hush_test/hush-psubst/tick_in_heredoc.tests b/shell/hush_test/hush-psubst/tick_in_heredoc.tests new file mode 100755 index 0000000..c8eb8f4 --- /dev/null +++ b/shell/hush_test/hush-psubst/tick_in_heredoc.tests @@ -0,0 +1,7 @@ +cat <