Magellan Linux

Annotation of /trunk/busybox/patches/busybox-1.24.2-ash-recursive-heredocs.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2779 - (hide annotations) (download)
Fri Apr 8 07:24:48 2016 UTC (8 years, 1 month ago) by niro
File size: 2442 byte(s)
-added 1.24.2 official patches
1 niro 2779 From 4194c2875310c13ee3ca2bb0e1aea6a2ae67c55a Mon Sep 17 00:00:00 2001
2     From: Ron Yorston <rmy@pobox.com>
3     Date: Thu, 29 Oct 2015 16:44:56 +0000
4     Subject: [PATCH] ash: fix error during recursive processing of here document
5    
6     Save the value of the checkkwd flag to prevent it being clobbered
7     during recursion.
8    
9     Based on commit ec2c84d from git://git.kernel.org/pub/scm/utils/dash/dash.git
10     by Herbert Xu.
11    
12     function old new delta
13     readtoken 190 203 +13
14     ------------------------------------------------------------------------------
15     (add/remove: 0/0 grow/shrink: 1/0 up/down: 13/0) Total: 13 bytes
16    
17     Signed-off-by: Ron Yorston <rmy@pobox.com>
18     Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
19     Signed-off-by: Mike Frysinger <vapier@gentoo.org>
20     (cherry picked from commit 713f07d906d9171953be0c12e2369869855b6ca6)
21     ---
22     shell/ash.c | 5 +++--
23     shell/ash_test/ash-heredoc/heredoc3.right | 1 +
24     shell/ash_test/ash-heredoc/heredoc3.tests | 9 +++++++++
25     3 files changed, 13 insertions(+), 2 deletions(-)
26     create mode 100644 shell/ash_test/ash-heredoc/heredoc3.right
27     create mode 100755 shell/ash_test/ash-heredoc/heredoc3.tests
28    
29     diff --git a/shell/ash.c b/shell/ash.c
30     index 8a1628e..256e933 100644
31     --- a/shell/ash.c
32     +++ b/shell/ash.c
33     @@ -11893,6 +11893,7 @@ static int
34     readtoken(void)
35     {
36     int t;
37     + int kwd = checkkwd;
38     #if DEBUG
39     smallint alreadyseen = tokpushback;
40     #endif
41     @@ -11906,7 +11907,7 @@ readtoken(void)
42     /*
43     * eat newlines
44     */
45     - if (checkkwd & CHKNL) {
46     + if (kwd & CHKNL) {
47     while (t == TNL) {
48     parseheredoc();
49     t = xxreadtoken();
50     @@ -11920,7 +11921,7 @@ readtoken(void)
51     /*
52     * check for keywords
53     */
54     - if (checkkwd & CHKKWD) {
55     + if (kwd & CHKKWD) {
56     const char *const *pp;
57    
58     pp = findkwd(wordtext);
59     diff --git a/shell/ash_test/ash-heredoc/heredoc3.right b/shell/ash_test/ash-heredoc/heredoc3.right
60     new file mode 100644
61     index 0000000..ce01362
62     --- /dev/null
63     +++ b/shell/ash_test/ash-heredoc/heredoc3.right
64     @@ -0,0 +1 @@
65     +hello
66     diff --git a/shell/ash_test/ash-heredoc/heredoc3.tests b/shell/ash_test/ash-heredoc/heredoc3.tests
67     new file mode 100755
68     index 0000000..96c227c
69     --- /dev/null
70     +++ b/shell/ash_test/ash-heredoc/heredoc3.tests
71     @@ -0,0 +1,9 @@
72     +echo hello >greeting
73     +cat <<EOF &&
74     +$(cat greeting)
75     +EOF
76     +{
77     + echo $?
78     + cat greeting
79     +} >/dev/null
80     +rm greeting
81     --
82     2.7.4
83