[PATCH 5/5] ash: fix error during recursive processing of here document
Denys Vlasenko
vda.linux at googlemail.com
Thu Oct 29 19:17:34 UTC 2015
This collides with shell/ash_test/ash-heredoc/heredoc2.right,
for your other patch which I already applied.
Can you rediff against current git? Sorry...
On Mon, Aug 3, 2015 at 2:47 PM, Ron Yorston <rmy at pobox.com> wrote:
> 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 at pobox.com>
> ---
> shell/ash.c | 5 +++--
> shell/ash_test/ash-heredoc/heredoc2.right | 1 +
> shell/ash_test/ash-heredoc/heredoc2.tests | 9 +++++++++
> 3 files changed, 13 insertions(+), 2 deletions(-)
> create mode 100644 shell/ash_test/ash-heredoc/heredoc2.right
> create mode 100755 shell/ash_test/ash-heredoc/heredoc2.tests
>
> diff --git a/shell/ash.c b/shell/ash.c
> index 7ba9a7f..db6fb8f 100644
> --- a/shell/ash.c
> +++ b/shell/ash.c
> @@ -11896,6 +11896,7 @@ static int
> readtoken(void)
> {
> int t;
> + int kwd = checkkwd;
> #if DEBUG
> smallint alreadyseen = tokpushback;
> #endif
> @@ -11909,7 +11910,7 @@ readtoken(void)
> /*
> * eat newlines
> */
> - if (checkkwd & CHKNL) {
> + if (kwd & CHKNL) {
> while (t == TNL) {
> parseheredoc();
> t = xxreadtoken();
> @@ -11923,7 +11924,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/heredoc2.right b/shell/ash_test/ash-heredoc/heredoc2.right
> new file mode 100644
> index 0000000..ce01362
> --- /dev/null
> +++ b/shell/ash_test/ash-heredoc/heredoc2.right
> @@ -0,0 +1 @@
> +hello
> diff --git a/shell/ash_test/ash-heredoc/heredoc2.tests b/shell/ash_test/ash-heredoc/heredoc2.tests
> new file mode 100755
> index 0000000..96c227c
> --- /dev/null
> +++ b/shell/ash_test/ash-heredoc/heredoc2.tests
> @@ -0,0 +1,9 @@
> +echo hello >greeting
> +cat <<EOF &&
> +$(cat greeting)
> +EOF
> +{
> + echo $?
> + cat greeting
> +} >/dev/null
> +rm greeting
> --
> 2.4.3
>
> _______________________________________________
> busybox mailing list
> busybox at busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox
More information about the busybox
mailing list