diff options
author | Guy Harris <guy@alum.mit.edu> | 2016-03-23 18:06:54 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2016-03-24 01:09:03 +0000 |
commit | 172b74d734127e88bb305d4dc691da7a81ca5deb (patch) | |
tree | 7a713565c7918eed87c2f8441de9b71fd90b0bcd /tools | |
parent | c1692d989e56c07a7fce1742600548935ea1cc6f (diff) | |
download | wireshark-172b74d734127e88bb305d4dc691da7a81ca5deb.tar.gz |
Portably remove CRs from Python output.
The GNU sed manual says the only C-style backslash escapes that can be
used in regular expressions in portable sed scripts are \n and \\.
The Single UNIX Specification says that \r is one of the C-style
backslash escapes that can be used in tr, so use tr -d instead.
Change-Id: I40d97ee9b89dfce3d67f062ec8839d3aba998ff3
Reviewed-on: https://code.wireshark.org/review/14606
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/pre-commit | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/tools/pre-commit b/tools/pre-commit index 9defcd1cb4..61143e92f6 100755 --- a/tools/pre-commit +++ b/tools/pre-commit @@ -63,13 +63,16 @@ if [ $? -ne 0 ]; then exit 1 fi -# On windows python will output \r\n line endings - we don't want that -# On systems using a version of sed that doesn't support C-style -# backslash escapes in search patterns - this probably includes most -# if not all of the *BSDs as well as OS X, and might include any system -# not using GNU sed - the line below will remove all 'r' characters from -# the filenames - we want this even less. -#CHECK_FILES=`echo "$CHECK_FILES" | sed 's/\r//g'` +# On windows python will output \r\n line endings - we don't want that. +# +# Do not use sed, as not all versions of sed support \r as meaning CR +# in a regexp - the only version that does so might be GNU sed; the +# GNU sed documentation says that only \n and \\ can be used in a +# portable script. +# +# The Single UNIX Specification says that tr supports \r; most if not +# all modern UN*Xes should support it. +CHECK_FILES=`echo "$CHECK_FILES" | tr -d '\r'` for FILE in $CHECK_FILES; do |