diff options
author | Pádraig Brady <P@draigBrady.com> | 2016-11-03 15:36:48 +0000 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2016-11-05 00:44:06 +0000 |
commit | 9ad400f1adfcb90289107afcbc49469560ba14b5 (patch) | |
tree | 3c6caf709f0713364ac2b9d9270bff211052b414 /tests/misc | |
parent | 6f64cb64f7e1f14bb8968a8838cc3bbe9d28d10b (diff) | |
download | coreutils-9ad400f1adfcb90289107afcbc49469560ba14b5.tar.xz |
stat: make --format=%N honor the QUOTING_STYLE env var
* doc/coreutils.texi (stat invocation): Describe the
QUOTING_STYLE values now supported.
* src/stat.c (getenv_quoting_style): A new function called
from main, that sets the default quoting style for quotearg.
(main): Call getenv_quoting_style() when %N specified.
* tests/misc/stat-fmt.sh: Add a test case.
* NEWS: Mention the improvement.
Fixes http://bugs.gnu.org/23422
Diffstat (limited to 'tests/misc')
-rwxr-xr-x | tests/misc/stat-fmt.sh | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/misc/stat-fmt.sh b/tests/misc/stat-fmt.sh index baa7ca775..1245ddb9e 100755 --- a/tests/misc/stat-fmt.sh +++ b/tests/misc/stat-fmt.sh @@ -20,11 +20,24 @@ print_ver_ stat - +# ensure that stat properly handles a format string ending with % for i in $(seq 50); do fmt=$(printf "%${i}s" %) out=$(stat --form="$fmt" .) test "$out" = "$fmt" || fail=1 done +# ensure QUOTING_STYLE is honored by %N +touch "'" || framework_failure_ +# Default since v8.25 +stat -c%N \' >> out || fail=1 +# Default before v8.25 +QUOTING_STYLE=locale stat -c%N \' >> out || fail=1 +cat <<\EOF >exp +"'" +'\'' +EOF +compare exp out || fail=1 + + Exit $fail |