Eric Blake <ebb9 <at> byu.net> writes: > > + -e 's/\r//g' | > > I'm not sure that sed s/\r//g is portable. You may have to resort to tr > instead.
It's not (Solaris /bin/sed treats it like sed 's/\\r//g', looking for a 2-byte literal backslash and r sequence, rather than the intended 1-byte carriage return). Also, multiple sed -e is overkill when a single argument will do. And seeing the transformations in reverse order just looked weird. I'll be committing this (probably munged by gmane, since it also fixes some longer-than- 80-column lines): From: Eric Blake <[email protected]> Date: Thu, 13 Aug 2009 11:22:26 -0600 Subject: [PATCH] test-version-etc: fix CRLF portability issue * tests/test-version-etc.sh: Use tr, not sed, as not all sed recognize \r. * tests/test-argp-version-etc-1.sh: Likewise. Signed-off-by: Eric Blake <[email protected]> --- ChangeLog | 7 +++++++ tests/test-argp-version-etc-1.sh | 9 ++++----- tests/test-version-etc.sh | 7 +++---- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8e1f715..7a2c1c6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2009-08-13 Eric Blake <[email protected]> + test-version-etc: fix CRLF portability issue + * tests/test-version-etc.sh: Use tr, not sed, as not all sed + recognize \r. + * tests/test-argp-version-etc-1.sh: Likewise. + +2009-08-13 Eric Blake <[email protected]> + Improve git diff of texinfo files. * .gitattributes: Add rule for *.texi files, with hint on how to use it. diff --git a/tests/test-argp-version-etc-1.sh b/tests/test-argp-version-etc-1.sh index fb079dd..d1a14e6 100755 --- a/tests/test-argp-version-etc-1.sh +++ b/tests/test-argp-version-etc-1.sh @@ -23,7 +23,7 @@ ERR=0 cat > $TMP <<EOT test-argp-version-etc (PROJECT) VERSION -COPYRIGHT +COPYRIGHT Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. @@ -32,10 +32,9 @@ Written by Sergey Poznyakoff. EOT ./test-argp-version-etc${EXEEXT} --version | - sed \ - -e '2s/Copyright (C) [0-9]\{4,4\} Free Software Foundation, Inc\./COPYRIGHT/' \ - -e '1s/test-argp-version-etc (.*) .*/test-argp-version-etc (PROJECT) VERSION/' \ - -e 's/\r//g' | + sed '1s/test-argp-version-etc (.*) .*/test-argp-version-etc (PROJECT) VERSION/ + 2s/Copyright (C) [0-9]\{4,4\}/COPYRIGHT/' | + tr -d '\015' | diff -c $TMP - || ERR=1 rm $TMP diff --git a/tests/test-version-etc.sh b/tests/test-version-etc.sh index 032e10e..528fadd 100755 --- a/tests/test-version-etc.sh +++ b/tests/test-version-etc.sh @@ -32,10 +32,9 @@ Written by Sergey Poznyakoff and Eric Blake. EOT ./test-version-etc${EXEEXT} --version | - sed \ - -e '2s/Copyright (C) [0-9]\{4,4\}/COPYRIGHT/' \ - -e '1s/test-version-etc (.*) .*/test-version-etc (PROJECT) VERSION/' \ - -e 's/\r//g' | + sed '1s/test-version-etc (.*) .*/test-version-etc (PROJECT) VERSION/ + 2s/Copyright (C) [0-9]\{4,4\}/COPYRIGHT/' | + tr -d '\015' | diff -c $TMP - || ERR=1 rm $TMP -- 1.6.3.2
