From 9ad400f1adfcb90289107afcbc49469560ba14b5 Mon Sep 17 00:00:00 2001 From: Pádraig Brady Date: Thu, 3 Nov 2016 15:36:48 +0000 Subject: 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 --- tests/misc/stat-fmt.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'tests') 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 -- cgit v1.2.3-54-g00ecf