aboutsummaryrefslogtreecommitdiffstats
path: root/main/busybox/0001-ash-fix-error-during-recursive-processing-of-here-do.patch
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2015-10-29 18:15:30 +0100
committerNatanael Copa <ncopa@alpinelinux.org>2015-10-29 18:17:23 +0100
commit2f7367b214a4a9c4ec14b99fd9a45511ed9ee3a8 (patch)
tree5a59c290429f3387f5292643e4fcb06af6da06fb /main/busybox/0001-ash-fix-error-during-recursive-processing-of-here-do.patch
parent53a8ad90d2b9774b3397ce1bf3012a26c6765969 (diff)
downloadaports-2f7367b214a4a9c4ec14b99fd9a45511ed9ee3a8.tar.bz2
aports-2f7367b214a4a9c4ec14b99fd9a45511ed9ee3a8.tar.xz
main/busybox: fix heredocs in ash
Diffstat (limited to 'main/busybox/0001-ash-fix-error-during-recursive-processing-of-here-do.patch')
-rw-r--r--main/busybox/0001-ash-fix-error-during-recursive-processing-of-here-do.patch80
1 files changed, 80 insertions, 0 deletions
diff --git a/main/busybox/0001-ash-fix-error-during-recursive-processing-of-here-do.patch b/main/busybox/0001-ash-fix-error-during-recursive-processing-of-here-do.patch
new file mode 100644
index 0000000000..3e89a16aba
--- /dev/null
+++ b/main/busybox/0001-ash-fix-error-during-recursive-processing-of-here-do.patch
@@ -0,0 +1,80 @@
+From 0df7bfd74aadd258d040c25fbe9e63d0298fa63b Mon Sep 17 00:00:00 2001
+From: Ron Yorston <rmy@pobox.com>
+Date: Thu, 29 Oct 2015 16:44:56 +0000
+Subject: [PATCH] ash: fix error during recursive processing of here document
+
+Save the value of the checkkwd flag to prevent it being clobbered
+during recursion.
+
+Based on commit ec2c84d from git://git.kernel.org/pub/scm/utils/dash/dash.git
+by Herbert Xu.
+
+function old new delta
+readtoken 190 203 +13
+------------------------------------------------------------------------------
+(add/remove: 0/0 grow/shrink: 1/0 up/down: 13/0) Total: 13 bytes
+
+Signed-off-by: Ron Yorston <rmy@pobox.com>
+---
+ shell/ash.c | 5 +++--
+ shell/ash_test/ash-heredoc/heredoc3.right | 1 +
+ shell/ash_test/ash-heredoc/heredoc3.tests | 9 +++++++++
+ 3 files changed, 13 insertions(+), 2 deletions(-)
+ create mode 100644 shell/ash_test/ash-heredoc/heredoc3.right
+ create mode 100755 shell/ash_test/ash-heredoc/heredoc3.tests
+
+diff --git a/shell/ash.c b/shell/ash.c
+index f13dd2a..753eacf 100644
+--- a/shell/ash.c
++++ b/shell/ash.c
+@@ -11887,6 +11887,7 @@ static int
+ readtoken(void)
+ {
+ int t;
++ int kwd = checkkwd;
+ #if DEBUG
+ smallint alreadyseen = tokpushback;
+ #endif
+@@ -11900,7 +11901,7 @@ readtoken(void)
+ /*
+ * eat newlines
+ */
+- if (checkkwd & CHKNL) {
++ if (kwd & CHKNL) {
+ while (t == TNL) {
+ parseheredoc();
+ t = xxreadtoken();
+@@ -11914,7 +11915,7 @@ readtoken(void)
+ /*
+ * check for keywords
+ */
+- if (checkkwd & CHKKWD) {
++ if (kwd & CHKKWD) {
+ const char *const *pp;
+
+ pp = findkwd(wordtext);
+diff --git a/shell/ash_test/ash-heredoc/heredoc3.right b/shell/ash_test/ash-heredoc/heredoc3.right
+new file mode 100644
+index 0000000..ce01362
+--- /dev/null
++++ b/shell/ash_test/ash-heredoc/heredoc3.right
+@@ -0,0 +1 @@
++hello
+diff --git a/shell/ash_test/ash-heredoc/heredoc3.tests b/shell/ash_test/ash-heredoc/heredoc3.tests
+new file mode 100755
+index 0000000..96c227c
+--- /dev/null
++++ b/shell/ash_test/ash-heredoc/heredoc3.tests
+@@ -0,0 +1,9 @@
++echo hello >greeting
++cat <<EOF &&
++$(cat greeting)
++EOF
++{
++ echo $?
++ cat greeting
++} >/dev/null
++rm greeting
+--
+2.6.1
+