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

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

From
Ben Walton <bdwalton@gmail.com>
Date
Jul 19, 2015, 18:00 UTC
Message-ID
<1437328836-19156-4-git-send-email-bdwalton@gmail.com>
In-Reply-To
<1437328836-19156-1-git-send-email-bdwalton@gmail.com>

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 perform the substitution instead.
Signed-off-by: Ben Walton <bdwalton@gmail.com>
---
 t/t9500-gitweb-standalone-no-errors.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/t9500-gitweb-standalone-no-errors.sh b/t/t9500-gitweb-standalone-no-errors.sh
index e94b2f1..a7383fa 100755
--- a/t/t9500-gitweb-standalone-no-errors.sh
+++ b/t/t9500-gitweb-standalone-no-errors.sh
@@ -290,7 +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+ &&
+	perl -pne "s/CHANGE_ME/change_me/" file >file+ &&
 	mv -f file+ file &&
 	git commit -a -m "Incomplete context line" &&
 	git tag incomplete_lines_ctx &&
-- 
2.1.4
Previous: Ben WaltonNext: Johannes Sixt
Message 5 of 6 in “Adapt some tests to work around broken Solaris tools”
  1. Ben WaltonJul 19, 2015
  2. 1/3 Modify tr expressions so that xpg4/tr handles it on SolarisBen Walton, Jul 19, 2015
  3. Eric SunshineJul 19, 2015
  4. 2/3 Fix sed usage in tests to work around broken xpg4/sed on SolarisBen Walton, Jul 19, 2015
  5. 3/3 Fix sed usage in tests to work around broken xpg4/sed on SolarisBen Walton, Jul 19, 2015
  6. Johannes SixtJul 19, 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.