summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--shell/ash.c2
-rw-r--r--shell/ash_test/ash-psubst/tick_in_heredoc.right5
-rwxr-xr-xshell/ash_test/ash-psubst/tick_in_heredoc.tests7
-rw-r--r--shell/hush_test/hush-psubst/tick_in_heredoc.right5
-rwxr-xr-xshell/hush_test/hush-psubst/tick_in_heredoc.tests7
5 files changed, 25 insertions, 1 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 90496ba..dfe6d1c 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -6578,7 +6578,7 @@ expbackq(union node *cmd, int flag)
/* Eat all trailing newlines */
dest = expdest;
- for (; dest > (char *)stackblock() && dest[-1] == '\n';)
+ for (; dest > ((char *)stackblock() + startloc) && dest[-1] == '\n';)
STUNPUTC(dest);
expdest = dest;
diff --git a/shell/ash_test/ash-psubst/tick_in_heredoc.right b/shell/ash_test/ash-psubst/tick_in_heredoc.right
new file mode 100644
index 0000000..7e7bac6
--- /dev/null
+++ b/shell/ash_test/ash-psubst/tick_in_heredoc.right
@@ -0,0 +1,5 @@
+1
+
+2
+
+3
diff --git a/shell/ash_test/ash-psubst/tick_in_heredoc.tests b/shell/ash_test/ash-psubst/tick_in_heredoc.tests
new file mode 100755
index 0000000..c8eb8f4
--- /dev/null
+++ b/shell/ash_test/ash-psubst/tick_in_heredoc.tests
@@ -0,0 +1,7 @@
+cat <<END
+1
+$(echo "")
+2
+`echo ""`
+3
+END
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 <<END
+1
+$(echo "")
+2
+`echo ""`
+3
+END