public inbox for dash@vger.kernel.org
 help / color / mirror / Atom feed
* bash 0.5.13: breaks buiding of inetutils
@ 2025-10-04 12:11 Juergen Daubert
  2025-10-06  3:26 ` [PATCH] builtin: Keep backslash on quotes outside of dollarsq Herbert Xu
  0 siblings, 1 reply; 3+ messages in thread
From: Juergen Daubert @ 2025-10-04 12:11 UTC (permalink / raw)
  To: dash

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;
      |                               ^~~~~~~~~~~~~
<command-line>: error: 'var' undeclared here (not in a function)
inetd.c:193:36: note: in expansion of macro 'PATH_INETDPID'
  193 |    "override pidfile (default: \"" PATH_INETDPID "\")",
      |                                    ^~~~~~~~~~~~~
<command-line>: error: 'run' undeclared here (not in a function)
inetd.c:193:36: note: in expansion of macro 'PATH_INETDPID'
  193 |    "override pidfile (default: \"" PATH_INETDPID "\")",
      |                                    ^~~~~~~~~~~~~
<command-line>: error: 'inetd' undeclared here (not in a function); did you mean 'int'?
inetd.c:193:36: note: in expansion of macro 'PATH_INETDPID'
  193 |    "override pidfile (default: \"" PATH_INETDPID "\")",
      |                                    ^~~~~~~~~~~~~
inetd.c:193:50: error: expected '}' before string constant
  193 |    "override pidfile (default: \"" PATH_INETDPID "\")",
      |                                                  ^~~~~
inetd.c:192:3: note: to match this '{'
  192 |   {"pidfile", 'p', "PIDFILE", OPTION_ARG_OPTIONAL,
      |   ^
inetd.c: In function 'main':
<command-line>: error: expected expression before '/' token
inetd.c:1955:33: note: in expansion of macro 'PATH_INETDCONF'
 1955 |       config_files[0] = newstr (PATH_INETDCONF);
      |                                 ^~~~~~~~~~~~~~
<command-line>: error: expected expression before '/' token
inetd.c:1956:33: note: in expansion of macro 'PATH_INETDDIR'
 1956 |       config_files[1] = newstr (PATH_INETDDIR);
      |                                 ^~~~~~~~~~~~~
make[2]: *** [Makefile:2440: inetd.o] Error 1


Note: dash 0.5.12 works as expected with inetutils. 


Greetings
Juergen


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] builtin: Keep backslash on quotes outside of dollarsq
  2025-10-04 12:11 bash 0.5.13: breaks buiding of inetutils Juergen Daubert
@ 2025-10-06  3:26 ` Herbert Xu
  2025-10-06 15:12   ` j.daubert
  0 siblings, 1 reply; 3+ messages in thread
From: Herbert Xu @ 2025-10-06  3:26 UTC (permalink / raw)
  To: Juergen Daubert; +Cc: dash

Juergen Daubert <j.daubert@posteo.de> 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 <j.daubert@posteo.de>
Fixes: 776424a8f915 ("parser: Add dollar single quote")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

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') {
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] builtin: Keep backslash on quotes outside of dollarsq
  2025-10-06  3:26 ` [PATCH] builtin: Keep backslash on quotes outside of dollarsq Herbert Xu
@ 2025-10-06 15:12   ` j.daubert
  0 siblings, 0 replies; 3+ messages in thread
From: j.daubert @ 2025-10-06 15:12 UTC (permalink / raw)
  To: Herbert Xu; +Cc: dash

Thanks, the patch fixes the build problem of inetutils for me.

Am 06.10.2025 05:26 schrieb Herbert Xu:
> Juergen Daubert <j.daubert@posteo.de> 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 <j.daubert@posteo.de>
> Fixes: 776424a8f915 ("parser: Add dollar single quote")
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
> 
> 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') {

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-10-06 15:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-04 12:11 bash 0.5.13: breaks buiding of inetutils Juergen Daubert
2025-10-06  3:26 ` [PATCH] builtin: Keep backslash on quotes outside of dollarsq Herbert Xu
2025-10-06 15:12   ` j.daubert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox