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

Re: Solaris sed

From
Brad Smith <brad@comstyle.com>
Date
Jun 12, 2025, 04:13 UTC
Message-ID
<caaa5d54-d32d-40b3-9bf3-0f322e7c4316@comstyle.com>
In-Reply-To
<xmqqo6utfvxu.fsf@gitster.g>
On 2025-06-12 12:03 a.m., Junio C Hamano wrote:
Show 91 quoted lines
> Brad Smith <brad@comstyle.com> writes:
>
>> Building on Solaris I noticed the following two issues with Solaris sed.
>>
>>      GEN version-def.h
>> sed: Missing newline at end of file standard input.
> Perhaps it is this input line it is complaining about.  sed works on
> text files, and a file that ends in incomplete line was not quite
> text.
>
> -REPLACED=$(printf "%s" "$INPUT" | sed -e "s|@GIT_VERSION@|$GIT_VERSION|" \
> +REPLACED=$(printf "%s\n" "$INPUT" | sed -e "s|@GIT_VERSION@|$GIT_VERSION|" \
>   	-e "s|@GIT_MAJOR_VERSION@|$GIT_MAJOR_VERSION|" \
>   	-e "s|@GIT_MINOR_VERSION@|$GIT_MINOR_VERSION|" \
>   	-e "s|@GIT_MICRO_VERSION@|$GIT_MICRO_VERSION|" \
>
>>      GEN config-list.h
>> sed: illegal option -- E
>> Usage:  sed [-n] script [file...]
>>          sed [-n] [-e script]...[-f script_file]...[file...]
> This is a bit trickier but should be doable.  It does not like the
> -E option to use ERE (as opposed to BRE) for pattern matching used
> in generate-configlist.sh script.
>
> 	sed -E '
> 	/^`?[a-zA-Z].*\..*`?::$/ {
> 	/deprecated/d;
> 	s/::$//;
> 	s/`//g;
> 	s/^.*$/	"&",/;
> 	p;};
> 	d'
>
> I think the only problematic one is the first address, whose BRE
> equivalent I think is
>
> 	/^`\{0,1\}[a-zA-Z].*\..*`\{0,1\}::$/
>
> In practice, I suspect \{0,1\} is unnecessarily strict and using
> something looser like
>
> 	/^`*[a-zA-Z].*\..*`*::$/
>
> may be sufficient.  Replace the address expression associated with
> the {editing command} and drop "-E", and use "-e" for readability,
> perhaps?
>
> Totally untested patch follows.
>
>   GIT-VERSION-GEN        | 2 +-
>   generate-configlist.sh | 8 ++++----
>   2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git c/GIT-VERSION-GEN w/GIT-VERSION-GEN
> index 208e91a17f..de989657fb 100755
> --- c/GIT-VERSION-GEN
> +++ w/GIT-VERSION-GEN
> @@ -82,7 +82,7 @@ read GIT_MAJOR_VERSION GIT_MINOR_VERSION GIT_MICRO_VERSION GIT_PATCH_LEVEL trail
>   $(echo "$GIT_VERSION" 0 0 0 0 | tr '.a-zA-Z-' ' ')
>   EOF
>   
> -REPLACED=$(printf "%s" "$INPUT" | sed -e "s|@GIT_VERSION@|$GIT_VERSION|" \
> +REPLACED=$(printf "%s\n" "$INPUT" | sed -e "s|@GIT_VERSION@|$GIT_VERSION|" \
>   	-e "s|@GIT_MAJOR_VERSION@|$GIT_MAJOR_VERSION|" \
>   	-e "s|@GIT_MINOR_VERSION@|$GIT_MINOR_VERSION|" \
>   	-e "s|@GIT_MICRO_VERSION@|$GIT_MICRO_VERSION|" \
> diff --git c/generate-configlist.sh w/generate-configlist.sh
> index 9d2ad6165d..75c39ade20 100755
> --- c/generate-configlist.sh
> +++ w/generate-configlist.sh
> @@ -13,16 +13,16 @@ print_config_list () {
>   	cat <<EOF
>   static const char *config_name_list[] = {
>   EOF
> -	sed -E '
> -/^`?[a-zA-Z].*\..*`?::$/ {
> +	sed -e '
> +	/^`*[a-zA-Z].*\..*`*::$/ {
>   	/deprecated/d;
>   	s/::$//;
>   	s/`//g;
>   	s/^.*$/	"&",/;
>   	p;};
> -d' \
> +	d' \
>   	    "$SOURCE_DIR"/Documentation/*config.adoc \
> -	    "$SOURCE_DIR"/Documentation/config/*.adoc|
> +	    "$SOURCE_DIR"/Documentation/config/*.adoc |
>   	sort
>   	cat <<EOF
>   	NULL,
No errors or warnings after this is applied.
Previous: Junio C HamanoNext: Collin Funk
Message 8 of 15 in “Solaris sed”
  1. Brad SmithJun 12, 2025
  2. Collin FunkJun 12, 2025
  3. Brad SmithJun 12, 2025
  4. Eli SchwartzJun 12, 2025
  5. Collin FunkJun 12, 2025
  6. Brad SmithJun 12, 2025
  7. Junio C HamanoJun 12, 2025
  8. Brad SmithJun 12, 2025
  9. Collin FunkJun 12, 2025
  10. Jean-Noël AVILAJun 13, 2025
  11. Eric SunshineJun 13, 2025
  12. Collin FunkJun 13, 2025
  13. Eric SunshineJun 12, 2025
  14. Paul SmithJun 12, 2025
  15. Eric SunshineJun 12, 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.