All of lore.kernel.org
 help / color / mirror / Atom feed
From: Phillip Wood <phillip.wood123@gmail.com>
To: Toon Claes <toon@iotcl.com>, git@vger.kernel.org
Cc: "D. Ben Knoble" <ben.knoble+github@gmail.com>,
	Patrick Steinhardt <ps@pks.im>
Subject: Re: [PATCH v2] generate-configlist: collapse depfile for older Ninja
Date: Wed, 22 Apr 2026 14:45:45 +0100	[thread overview]
Message-ID: <0557838b-214d-4e8f-9cbd-bc342563e9ba@gmail.com> (raw)
In-Reply-To: <20260422-toon-fix-almalinux8-v2-1-45d8471ed0e9@iotcl.com>

Hi Toon

On 22/04/2026 08:21, Toon Claes wrote:

Thanks for the excellent commit message which I've trimmed.

> diff --git a/tools/generate-configlist.sh b/tools/generate-configlist.sh
> index e28054f9e0..f5f42492c6 100755
> --- a/tools/generate-configlist.sh
> +++ b/tools/generate-configlist.sh
> @@ -44,7 +44,9 @@ then
>   	{
>   		printf '%s\n' "$SOURCE_DIR"/Documentation/*config.adoc \
>   			"$SOURCE_DIR"/Documentation/config/*.adoc |
> -			sed -e 's/[# ]/\\&/g' -e "s/^/$QUOTED_OUTPUT: /"
> +			sed -e 's/[# ]/\\&/g' |
> +			tr '\n' ' ' |
> +			sed -e "s/^/$QUOTED_OUTPUT: /" -e 's/ $/\n/'

I don't think this use of '\n' portable. The sed man page [1] says that 
'\n' matches a newline in the pattern space, but does not mention it 
being supported in the replacement string. We do have an existing use in 
t4150-am.sh:"am newline in subject" which does

	sed -e "s/second/second \\\n foo/" patch1 >patchnl &&

However if I add "cat patchnl" it shows the subject line is

	Subject: [PATCH] second \n foo

so sed has inserted "\n" rather than a newline. Indeed looking at the 
commit message for that test it is testing a fix that c escapes are 
printed verbatim introduced by 4b7cc26a74 (git-am: use printf instead of 
echo on user-supplied strings, 2007-05-25).

I've not tested it but I think

	sed 's/ $/\
/'

will insert a newline. Alternatively we could do

	printf '%s' "$QUOTED_OUTPUT: "
	printf '%s\n' "$SOURCE_DIR"/Documentation/*config.adoc \
  			"$SOURCE_DIR"/Documentation/config/*.adoc |
		sed -e 's/[# ]/\\&/g' |
		tr '\n' ' '
	printf '\n'

That leaves a trailing space at the end of the line but I don't think 
that should matter.

As I recall, the depfiles created by gcc have all the dependencies on a 
single line so this should be widely supported and I agree with Patrick 
that we should do this unconditionally.

Thanks

Phillip

[1] https://pubs.opengroup.org/onlinepubs/9699919799/utilities/sed.html

>   		printf '%s:\n' "$SOURCE_DIR"/Documentation/*config.adoc \
>   			"$SOURCE_DIR"/Documentation/config/*.adoc |
>   			sed -e 's/[# ]/\\&/g'
> 
> ---
> base-commit: 94f057755b7941b321fd11fec1b2e3ca5313a4e0
> change-id: 20260421-toon-fix-almalinux8-102de9138294
> 
> 


  parent reply	other threads:[~2026-04-22 13:45 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-21 19:17 [PATCH] generate-configlist: collapse depfile for older Ninja Toon Claes
2026-04-22  6:36 ` Patrick Steinhardt
2026-04-22  7:09   ` Toon Claes
2026-04-22  7:21 ` [PATCH v2] " Toon Claes
2026-04-22 10:30   ` Patrick Steinhardt
2026-04-22 13:45   ` Phillip Wood [this message]
2026-04-22 14:12     ` Phillip Wood
2026-05-15  8:44     ` Toon Claes
2026-05-15  8:42   ` [PATCH v3] " Toon Claes
2026-05-15  9:35     ` Phillip Wood
2026-04-22 18:35 ` [PATCH] " D. Ben Knoble

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=0557838b-214d-4e8f-9cbd-bc342563e9ba@gmail.com \
    --to=phillip.wood123@gmail.com \
    --cc=ben.knoble+github@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=phillip.wood@dunelm.org.uk \
    --cc=ps@pks.im \
    --cc=toon@iotcl.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.