Re: [PATCH] builtin: Keep backslash on quotes outside of dollarsq

[email protected] Mon, 06 Oct 2025 15:12:10 +0000
Newsgroups org.kernel.vger.dash
Message-ID <[email protected]>
Thanks, the patch fixes the build problem of inetutils for me.

Am 06.10.2025 05:26 schrieb Herbert Xu:
> Juergen Daubert <[email protected]> wrote:
>> I'm using dash 0.5.13 with the two patches
>> 
>>  [PATCH] expand: Fix off-by-one bug in expmeta
>>  [PATCH] expand: Fix typo in pmatch for wildcard search
>> 
>> as /bin/sh and get the folling breaking while building
>> GNU inetutils:
>> 
>> ...
>> make[2]: Entering directory '/tmp/inetutils/src/inetutils-2.6/src'
>>  CC       hostname.o
>>  CC       traceroute.o
>>  CC       inetd.o
>> <command-line>: error: expected expression before '/' token
>> inetd.c:166:31: note: in expansion of macro 'PATH_INETDPID'
>>  166 | static const char *pid_file = PATH_INETDPID;
>>      |                               ^~~~~~~~~~~~~
> 
> Thanks for the report! This is due to an unintended change in behaviour
> of echo '\"'.  Thie patch should fix the problem.
> 
> ---8<---
> Only dollar single quote should eat the backslash character before
> a quote.  Make the skipping of the backslash conditional on mbchar
> in conv_escape.
> 
> Reported-by: Juergen Daubert <[email protected]>
> Fixes: 776424a8f915 ("parser: Add dollar single quote")
> Signed-off-by: Herbert Xu <[email protected]>
> 
> diff --git a/src/bltin/printf.c b/src/bltin/printf.c
> index ff576ff..106aecd 100644
> --- a/src/bltin/printf.c
> +++ b/src/bltin/printf.c
> @@ -339,7 +339,7 @@ unsigned conv_escape(char *str0, char *out0, bool 
> mbchar)
> 
>  	switch (ch) {
>  	default:
> -		if (ch == '"' || ch == '\'')
> +		if (mbchar && (ch == '"' || ch == '\''))
>  			break;
> 
>  		if (ch == 'U') {