dash.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nikolai Merinov <n.merinov@inango-systems.com>
To: dash@vger.kernel.org, herbert@gondor.apana.org.au
Cc: os <os@inango-systems.com>
Subject: Re: [PATCH] expand: Fix trailing newlines processing in backquote expanding
Date: Mon, 13 Jan 2020 14:08:05 +0200 (IST)	[thread overview]
Message-ID: <130240790.41627.1578917285464.JavaMail.zimbra@inango-systems.com> (raw)
In-Reply-To: <20190429141337.6804-1-n.merinov@inango-systems.com>

Hi Herbert,

Do you want any changes to this patch from us? This patch in state "Under Review" more then 8 months.

Regards,
Nikolai

----- Original Message -----
> From: "n merinov" <n.merinov@inango-systems.com>
> To: dash@vger.kernel.org
> Cc: "os" <os@inango-systems.com>, "n merinov" <n.merinov@inango-systems.com>
> Sent: Monday, April 29, 2019 7:13:37 PM
> Subject: [PATCH] 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 <<END
>    1
>    $(echo "")
>    2
>    END
> 
> prints "1<newline>2" instead of expected "1<newline><newline>2".
> 
> This patch fixes trailing newlines processing in backquote expanding.
> 
> Signed-off-by: Nikolai Merinov <n.merinov@inango-systems.com>
> ---
> src/expand.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/expand.c b/src/expand.c
> index af9cac9..1b1f95e 100644
> --- a/src/expand.c
> +++ b/src/expand.c
> @@ -525,7 +525,7 @@ read:
> 
> 	/* 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;
> 
> --
> 2.17.1

       reply	other threads:[~2020-01-13 12:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190429141337.6804-1-n.merinov@inango-systems.com>
2020-01-13 12:08 ` Nikolai Merinov [this message]
2020-01-15  6:00   ` Herbert Xu
2020-01-20  9:56 ` Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=130240790.41627.1578917285464.JavaMail.zimbra@inango-systems.com \
    --to=n.merinov@inango-systems.com \
    --cc=dash@vger.kernel.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=os@inango-systems.com \
    --subject='Re: [PATCH] expand: Fix trailing newlines processing in backquote expanding' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).