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

Re: [PATCH 2/2] Fix sed usage in tests to work around broken xpg4/sed on Solaris

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Jul 19, 2015, 03:39 UTC
Message-ID
<CAPig+cSXUoMniWABY-LrH=Z-A6josuAfqW7BVBTXPKG=vd7ouA@mail.gmail.com>
In-Reply-To
<1437232892-27978-1-git-send-email-bdwalton@gmail.com>
On Sat, Jul 18, 2015 at 11:21 AM, Ben Walton <bdwalton@gmail.com> wrote:
Show 27 quoted lines
> The space following the last / in a sed command caused Solaris'
> xpg4/sed to fail, claiming the program was garbled and exit with
> status 2:
>
> % echo 'foo' | /usr/xpg4/bin/sed -e 's/foo/bar/ '
> sed: command garbled: s/foo/bar/
> % echo $?
> 2
>
> Fix this by simply removing the unnecessary space.
>
> Additionally, in 99094a7a, a trivial && breakage was fixed. This
> exposed a problem with the test when run on Solaris with xpg4/sed that
> had gone silently undetected since its introduction in
> e4bd10b2. Solaris' sed executes the requested substitution but prints
> a warning about the missing newline at the end of the file and exits
> with status 2.
>
> % echo "CHANGE_ME" | \
> tr -d "\\012" | /usr/xpg4/bin/sed -e 's/CHANGE_ME/change_me/'
> sed: Missing newline at end of file standard input.
> change_me
> % echo $?
> 2
>
> To work around this, use perl to execute the substitution instead. By
> using inplace replacement, we can subsequently drop the mv command.
This two unrelated fixes could be separate patches...
Show 31 quoted lines
> Signed-off-by: Ben Walton <bdwalton@gmail.com>
> ---
> diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh
> index fa6be3c..2583f84 100755
> --- a/t/t5601-clone.sh
> +++ b/t/t5601-clone.sh
> @@ -445,7 +445,7 @@ test_expect_success 'clone ssh://host.xz:22/~repo' '
>  #IPv6
>  for tuah in ::1 [::1] [::1]: user@::1 user@[::1] user@[::1]: [user@::1] [user@::1]:
>  do
> -       ehost=$(echo $tuah | sed -e "s/1]:/1]/ " | tr -d "\133\135")
> +       ehost=$(echo $tuah | sed -e "s/1]:/1]/" | tr -d "\133\135")
>         test_expect_success "clone ssh://$tuah/home/user/repo" "
>           test_clone_url ssh://$tuah/home/user/repo $ehost /home/user/repo
>         "
> diff --git a/t/t9500-gitweb-standalone-no-errors.sh b/t/t9500-gitweb-standalone-no-errors.sh
> index e94b2f1..eb264f9 100755
> --- a/t/t9500-gitweb-standalone-no-errors.sh
> +++ b/t/t9500-gitweb-standalone-no-errors.sh
> @@ -290,8 +290,7 @@ test_expect_success 'setup incomplete lines' '
>         echo "incomplete" | tr -d "\\012" >>file &&
>         git commit -a -m "Add incomplete line" &&
>         git tag incomplete_lines_add &&
> -       sed -e s/CHANGE_ME/change_me/ <file >file+ &&
> -       mv -f file+ file &&
> +       perl -pi -e "s/CHANGE_ME/change_me/" file &&
>         git commit -a -m "Incomplete context line" &&
>         git tag incomplete_lines_ctx &&
>         echo "Dominus regit me," >file &&
> --
> 1.7.10.4
Previous: Ben WaltonNext: Johannes Sixt
Message 2 of 7 in “Fix sed usage in tests to work around broken xpg4/sed on Solaris”
  1. 2/2 Fix sed usage in tests to work around broken xpg4/sed on SolarisBen Walton, Jul 18, 2015
  2. Eric SunshineJul 19, 2015
  3. Johannes SixtJul 19, 2015
  4. Johannes SchindelinJul 19, 2015
  5. Johannes SixtJul 19, 2015
  6. Junio C HamanoJul 20, 2015
  7. Johannes SchindelinJul 22, 2015

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.