From 08e8fd7e38f2dae7c69c54eb22d508b6517e66e5 Mon Sep 17 00:00:00 2001 From: Pádraig Brady Date: Sun, 1 Nov 2015 18:53:26 +0000 Subject: all: avoid quoting file names when possible Quote file names using the "shell-escape" or "shell-escape-always" methods, which quote as appropriate for most shells, and better support copy and paste of presented names. The "always" variant is used when the file name is embedded in an error message with surrounding spaces. * cfg.mk (sc_error_shell_quotes): A new syntax check rule to suggest quotef() where appropriate. (sc_error_shell_always_quotes): Likewise for quoteaf(). * src/system.h (quotef): A new define to apply shell quoting when needed. I.E. when shell character or ':' is present. (quoteaf): Likewise, but always quote. * src/*.c: Use quotef() and quoteaf() rather than quote() where appropriate. * tests/: Adjust accordingly. --- tests/rm/d-1.sh | 2 +- tests/rm/d-3.sh | 2 +- tests/rm/r-1.sh | 4 ++-- tests/rm/r-2.sh | 4 ++-- tests/rm/v-slash.sh | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) (limited to 'tests/rm') diff --git a/tests/rm/d-1.sh b/tests/rm/d-1.sh index 43b753ebc..bde8c695c 100755 --- a/tests/rm/d-1.sh +++ b/tests/rm/d-1.sh @@ -25,7 +25,7 @@ mkdir a || framework_failure_ rm --verbose --dir a b > out || fail=1 cat <<\EOF > exp || framework_failure_ -removed directory: 'a' +removed directory 'a' removed 'b' EOF diff --git a/tests/rm/d-3.sh b/tests/rm/d-3.sh index af39da38b..1200ca459 100755 --- a/tests/rm/d-3.sh +++ b/tests/rm/d-3.sh @@ -28,7 +28,7 @@ printf "%s" \ > exp.err || framework_failure_ printf "%s\n" \ - "removed directory: 'd'" \ + "removed directory 'd'" \ > exp || framework_failure_ compare exp out || fail=1 diff --git a/tests/rm/r-1.sh b/tests/rm/r-1.sh index 21564c6a5..2a14110a3 100755 --- a/tests/rm/r-1.sh +++ b/tests/rm/r-1.sh @@ -23,8 +23,8 @@ mkdir a a/a || framework_failure_ > b || framework_failure_ cat <<\EOF > exp || framework_failure_ -removed directory: 'a/a' -removed directory: 'a' +removed directory 'a/a' +removed directory 'a' removed 'b' EOF diff --git a/tests/rm/r-2.sh b/tests/rm/r-2.sh index a99bdbf4b..a6616f648 100755 --- a/tests/rm/r-2.sh +++ b/tests/rm/r-2.sh @@ -25,8 +25,8 @@ mkdir t t/a t/a/b || framework_failure_ # FIXME: if this fails, it's a framework failure cat <<\EOF | sort > t/E || framework_failure_ -removed directory: 't/a' -removed directory: 't/a/b' +removed directory 't/a' +removed directory 't/a/b' removed 't/a/b/g' removed 't/a/f' EOF diff --git a/tests/rm/v-slash.sh b/tests/rm/v-slash.sh index 5cabb0bc6..5a5d401d5 100755 --- a/tests/rm/v-slash.sh +++ b/tests/rm/v-slash.sh @@ -26,7 +26,7 @@ touch a/x || framework_failure_ rm --verbose -r a/// > out || fail=1 cat <<\EOF > exp || fail=1 removed 'a/x' -removed directory: 'a/' +removed directory 'a/' EOF compare exp out || fail=1 -- cgit v1.2.3-70-g09d2