From: Brad Smith <brad@comstyle.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: Solaris sed
Date: Thu, 12 Jun 2025 00:13:25 -0400 [thread overview]
Message-ID: <caaa5d54-d32d-40b3-9bf3-0f322e7c4316@comstyle.com> (raw)
In-Reply-To: <xmqqo6utfvxu.fsf@gitster.g>
On 2025-06-12 12:03 a.m., Junio C Hamano wrote:
> 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.
next prev parent reply other threads:[~2025-06-12 4:13 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-12 3:23 Solaris sed Brad Smith
2025-06-12 3:42 ` Collin Funk
2025-06-12 3:49 ` Brad Smith
2025-06-12 4:16 ` Eli Schwartz
2025-06-12 4:25 ` Collin Funk
2025-06-12 4:26 ` Brad Smith
2025-06-12 4:03 ` Junio C Hamano
2025-06-12 4:13 ` Brad Smith [this message]
2025-06-12 4:19 ` Collin Funk
2025-06-13 20:13 ` Jean-Noël AVILA
2025-06-13 20:23 ` Eric Sunshine
2025-06-13 20:30 ` Collin Funk
2025-06-12 5:50 ` Eric Sunshine
2025-06-12 13:35 ` Paul Smith
2025-06-12 16:40 ` Eric Sunshine
-- strict thread matches above, loose matches on Subject: below --
2025-06-12 22:52 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=caaa5d54-d32d-40b3-9bf3-0f322e7c4316@comstyle.com \
--to=brad@comstyle.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox