git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] completion: Make sed command that generates config-list.h portable.

From
Jean-Noël AVILA <jn.avila@free.fr>
Date
Jun 2, 2025, 19:05 UTC
Message-ID
<4986157.GXAFRqVoOG@cayenne>
In-Reply-To
<0ab924839df48d869682bea1b0cb400f378ca6dc.1748889654.git.collin.funk1@gmail.com>
On Monday, 2 June 2025 20:41:48 CEST Collin Funk wrote:
Show 42 quoted lines
> The OpenBSD 'sed' command does not support '\n' to represent newlines in
> sed expressions. This leads to the follow compiler error:
> 
>     In file included from builtin/help.c:15:
>     ./config-list.h:282:18: error: use of undeclared identifier 'n'
>             "gitcvs.dbUser",n       "gitcvs.dbPass",
>                             ^
>     1 error generated.
>     gmake: *** [Makefile:2821: builtin/help.o] Error 1
> 
> We can use a variable that expands to a newline to do this portably.
> 
> This portably issue was introduced in e1b81f54da (completion: take into
> account the formatting backticks for options, 2025-03-19)
> 
> Signed-off-by: Collin Funk <collin.funk1@gmail.com>
> ---
>  generate-configlist.sh | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/generate-configlist.sh b/generate-configlist.sh
> index b06da53c89..48ec8d9812 100755
> --- a/generate-configlist.sh
> +++ b/generate-configlist.sh
> @@ -1,5 +1,8 @@
>  #!/bin/sh
> 
> +nl='
> +'
> +
>  SOURCE_DIR="$1"
>  OUTPUT="$2"
> 
> @@ -19,7 +22,7 @@ EOF
>  	s/::$//;
>  	s/`//g;
>  	s/^.*$/	"&",/;
> -	s/,  */",\n	"/g;
> +	s/,  */",''"$nl"''	"/g;
>  	p;};
>  d' \
>  	    "$SOURCE_DIR"/Documentation/*config.adoc \
Hello,

I was on this issue here: https://github.com/git/git/commit/e1b81f54da80267edee2cb8fd0d0f75f03023019

Your proposed fix is interesting in that it does not spawn an additional process, but it does not work for me (debian sh = dash).

ᐅ diff config-list.h config-list.h.new 281d280 < "gitcvs.dbPass", 283c282 < "gitcvs.dbUser", ---

>       "gitcvs.dbUser","$nl"   "gitcvs.dbPass",

350,351c349 < "http.lowSpeedLimit", < "http.lowSpeedTime", ---

>       "http.lowSpeedLimit","$nl"      "http.lowSpeedTime",

If you'd like to test your patch on different systems and happen to have a github account, you can open a PR to gitgitgadget/git . This will trigger builds on several targets.

Thanks,
JN
Previous: Brad SmithNext: Collin Funk
Message 3 of 20 in “completion: Make sed command that generates config-list.h portable.”
  1. completion: Make sed command that generates config-list.h portable.Collin Funk, Jun 2, 2025
  2. Brad SmithJun 2, 2025
  3. Jean-Noël AVILAJun 2, 2025
  4. Collin FunkJun 2, 2025
  5. completion: Make sed command that generates config-list.h portable.Collin Funk, Jun 2, 2025
  6. Jean-Noël AVILAJun 2, 2025
  7. Collin FunkJun 2, 2025
  8. Jacob KellerJun 2, 2025
  9. Collin FunkJun 2, 2025
  10. Junio C HamanoJun 3, 2025
  11. CodingGuidelines: document formatting required by generate-configlist.sh.Collin Funk, Jun 3, 2025
  12. Junio C HamanoJun 3, 2025
  13. Collin FunkJun 3, 2025
  14. Junio C HamanoJun 3, 2025
  15. Collin FunkJun 3, 2025
  16. CodingGuidelines: document formatting of similar config variables.Collin Funk, Jun 3, 2025
  17. Junio C HamanoJun 3, 2025
  18. completion: make sed command that generates config-list.h portable.Collin Funk, Jun 2, 2025
  19. Keller, Jacob EJun 2, 2025
  20. Junio C HamanoJun 3, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.