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

[PATCH FYI] Work around sed issues

From
Brandon Casey <casey@nrlssc.navy.mil>
Date
Aug 19, 2008, 00:18 UTC
Message-ID
<RJmd_We0BRt641swOemkgHiaYcXguvcn3HcZHHGRLDm-254BgNjVCw@cipher.nrlssc.navy.mil>
In-Reply-To
<IH0MHSTEimhAN93AedvpRKq4qfzm1QA814ZYyhbSBtSdNbq8vuE6aw@cipher.nrlssc.navy.mil>

/usr/xpg4/bin/sed exits non-zero if the sed script is not newline terminated. /bin/sed does not have this problem, so use it instead where possible.

But, /bin/sed does not handle tab correctly. For this case in t4200, rework the test so that the exit status of sed does not affect the outcome of the test, and use /usr/xpg4/bin/sed (which is in the PATH).

---
 t/annotate-tests.sh            |    2 +-
 t/t4118-apply-empty-context.sh |    2 +-
 t/t4200-rerere.sh              |    5 +++--
 3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/t/annotate-tests.sh b/t/annotate-tests.sh
index cacb273..14ee531 100644
--- a/t/annotate-tests.sh
+++ b/t/annotate-tests.sh
@@ -114,7 +114,7 @@ test_expect_success \
 test_expect_success \
     'some edit' \
     'mv file file.orig &&
-    sed -e "s/^3A/99/" -e "/^1A/d" -e "/^incomplete/d" < file.orig > file &&
+    /bin/sed -e "s/^3A/99/" -e "/^1A/d" -e "/^incomplete/d" < file.orig > file &&
     echo "incomplete" | tr -d "\\012" >>file &&
     GIT_AUTHOR_NAME="D" git commit -a -m "edit"'
 
diff --git a/t/t4118-apply-empty-context.sh b/t/t4118-apply-empty-context.sh
index f92e259..c064f7b 100755
--- a/t/t4118-apply-empty-context.sh
+++ b/t/t4118-apply-empty-context.sh
@@ -23,7 +23,7 @@ test_expect_success setup '
 	cat file2 >file2.orig
 	git add file1 file2 &&
 	sed -e "/^B/d" <file1.orig >file1 &&
-	sed -e "/^[BQ]/d" <file2.orig >file2 &&
+	/bin/sed -e "/^[BQ]/d" <file2.orig >file2 &&
 	echo Q | tr -d "\\012" >>file2 &&
 	cat file1 >file1.mods &&
 	cat file2 >file2.mods &&
diff --git a/t/t4200-rerere.sh b/t/t4200-rerere.sh
index b68ab11..834f52f 100755
--- a/t/t4200-rerere.sh
+++ b/t/t4200-rerere.sh
@@ -189,8 +189,9 @@ test_expect_success 'file2 added differently in two branches' '
 	echo Bello > file2 &&
 	git add file2 &&
 	git commit -m version2 &&
-	test_must_fail git merge fourth &&
-	sha1=$(sed -e "s/	.*//" .git/MERGE_RR) &&
+	test_must_fail git merge fourth || return 1
+	sha1=$(sed -e "s/	.*//" .git/MERGE_RR)
+	test -n "$sha1" &&
 	rr=.git/rr-cache/$sha1 &&
 	echo Cello > file2 &&
 	git add file2 &&
-- 
1.6.0.11.gecc7e
Previous: Brandon CaseyNext: Brandon Casey
Message 22 of 36 in “[FYI] How I compile on SunOS 5.7 with the SUNWspro compiler and ksh”
  1. Brandon CaseyAug 18, 2008
  2. Makefile: configuration for SunOS 5.7Brandon Casey, Aug 18, 2008
  3. dir.c: avoid c99 array initializationBrandon Casey, Aug 18, 2008
  4. David KågedalAug 28, 2008
  5. Andreas EricssonAug 28, 2008
  6. Brandon CaseyAug 28, 2008
  7. Junio C HamanoAug 28, 2008
  8. Brandon CaseyAug 28, 2008
  9. Alex RiesenAug 28, 2008
  10. Brandon CaseyAug 28, 2008
  11. Alex RiesenAug 28, 2008
  12. Shawn O. PearceAug 28, 2008
  13. Junio C HamanoAug 28, 2008
  14. dir.c: Avoid c99 array initializationBrandon Casey, Aug 28, 2008
  15. Alex RiesenAug 28, 2008
  16. Brandon CaseyAug 28, 2008
  17. Alex RiesenAug 28, 2008
  18. Johannes SchindelinAug 29, 2008
  19. reset,cat-file: remove const declaration from arrayBrandon Casey, Aug 19, 2008
  20. test-lib.sh: work around ksh's trap shortcomingsBrandon Casey, Aug 19, 2008
  21. t1002-read-tree-m-u-2way.sh: use 'git diff -U0' rather than 'diff -U0'Brandon Casey, Aug 19, 2008
  22. Work around sed issuesBrandon Casey, Aug 19, 2008
  23. t9301-fast-export.sh: don't unset config variable while we're skipping test 4Brandon Casey, Aug 19, 2008
  24. Jeff KingAug 19, 2008
  25. Brandon CaseyAug 19, 2008
  26. Jeff KingAug 19, 2008
  27. t9700/test.pl: backwards compatibility improvementsBrandon Casey, Aug 19, 2008
  28. Tom G. ChristensenSep 15, 2008
  29. Brandon CaseySep 15, 2008
  30. Brandon CaseySep 15, 2008
  31. 1/3 t9700/test.pl: no longer requires File::BasenameBrandon Casey, Sep 15, 2008
  32. 2/3 t9700/test.pl: avoid bareword 'STDERR' in 3-argument open()Brandon Casey, Sep 15, 2008
  33. 3/3 t9700/test.pl: remove File::Temp requirementBrandon Casey, Sep 15, 2008
  34. Tom G. ChristensenSep 15, 2008
  35. Alex RiesenAug 19, 2008
  36. Brandon CaseyAug 19, 2008

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.