threads / patch / 34930

patcht7508: avoid non-portable sed expression

Subject: [PATCH] t7508: avoid non-portable sed expression

## tl;dr

2 messages between Sep 14, 2013 and Sep 14, 2013. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Eric Sunshine· Sep 14, 2013, 04:47 UTC · lore

2556b996 (status: disable display of '#' comment prefix by default; 2013-09-06) introduced tests which fail on Mac OS X due to unportable use of \t (for TAB) in a sed expression. POSIX [1][2] also disallows it. Fix this.

[1]: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sed.html#tag_20_116_13_02 [2]: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_03_02

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
---
This applies against 'next'.
 t/t7508-status.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Show changes to t/t7508-status.sh +2 −1
diff --git a/t/t7508-status.sh b/t/t7508-status.sh
index 7d52dbf..6fb59f3 100755
--- a/t/t7508-status.sh
+++ b/t/t7508-status.sh
@@ -61,7 +61,8 @@ test_expect_success 'status (1)' '
 '
 
 strip_comments () {
-	sed "s/^\# //; s/^\#$//; s/^#\t/\t/" <"$1" >"$1".tmp &&
+	tab='	'
+	sed "s/^\# //; s/^\#$//; s/^#$tab/$tab/" <"$1" >"$1".tmp &&
 	rm "$1" && mv "$1".tmp "$1"
 }
 
-- 
1.8.4.535.g7b94f8e
Matthieu Moy· Sep 14, 2013, 17:50 UTC · re: Eric Sunshine · lore

Re: [PATCH] t7508: avoid non-portable sed expression

Eric Sunshine <sunshine@sunshineco.com> writes:
>  strip_comments () {
> -	sed "s/^\# //; s/^\#$//; s/^#\t/\t/" <"$1" >"$1".tmp &&
> +	tab='	'
> +	sed "s/^\# //; s/^\#$//; s/^#$tab/$tab/" <"$1" >"$1".tmp &&
Sounds trivially right.
Sorry for breaking this.
-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

← back to recent threads