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

[PATCH] Use perl instead of sed for t8006-blame-textconv test

From
Ben Walton <bwalton@artsci.utoronto.ca>
Date
Jan 10, 2012, 02:47 UTC
Message-ID
<1326163653-26565-2-git-send-email-bwalton@artsci.utoronto.ca>
In-Reply-To
<1326163653-26565-1-git-send-email-bwalton@artsci.utoronto.ca>

In test 'blame --textconv with local changes' of t8006-blame-textconv, using /usr/xpg4/bin/sed (as set by SANE_TOOL_PATH), an additional newline was added to the output from the 'helper' script.

This was noted by sed with a message such as: sed: Missing newline at end of file zero.bin.

Sed then exits with status 2 causing the helper script to also exit with status 2.

In turn, this was triggering a fatal error from git blame: fatal: unable to read files to diff

To work around this difference in sed behaviour, use perl -p instead of sed -e as it exits cleanly and does not insert the additional newline.

Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca>
---
 t/t8006-blame-textconv.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/t/t8006-blame-textconv.sh b/t/t8006-blame-textconv.sh
index 4ee42f1..c3c22f7 100755
--- a/t/t8006-blame-textconv.sh
+++ b/t/t8006-blame-textconv.sh
@@ -10,7 +10,7 @@ find_blame() {
 cat >helper <<'EOF'
 #!/bin/sh
 grep -q '^bin: ' "$1" || { echo "E: $1 is not \"binary\" file" 1>&2; exit 1; }
-sed 's/^bin: /converted: /' "$1"
+perl -p -e 's/^bin: /converted: /' "$1"
 EOF
 chmod +x helper
 
-- 
1.7.8.2
Previous: Ben WaltonNext: Junio C Hamano
Message 6 of 7 in “Work around sed portability issue in t8006-blame-textconv”
  1. Work around sed portability issue in t8006-blame-textconvBen Walton, Dec 31, 2011
  2. Junio C HamanoJan 3, 2012
  3. Junio C HamanoJan 6, 2012
  4. Ben WaltonJan 9, 2012
  5. 0/1 Re-roll of the test fix for sed on solarisBen Walton, Jan 10, 2012
  6. Use perl instead of sed for t8006-blame-textconv testBen Walton, Jan 10, 2012
  7. Junio C HamanoJan 10, 2012

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.