when operating in deep paths longer than twice the system PATH_MAX.
[bug introduced in coreutils-9.6]
+ 'stat --printf=%%N' no longer performs unnecessary checks of the QUOTING_STYLE
+ environment variable.
+ [bug introduced in coreutils-8.26]
+
** New Features
'date --date' now parses dot delimited dd.mm.yy format common in Europe.
if (format)
{
- if (strstr (format, "%N"))
+ bool need_quoting_style = false;
+ for (char const *p = format; (p = strchr (p, '%')); ++p)
+ {
+ if (p[1] == 'N' && (p == format || p[-1] != '%'))
+ {
+ need_quoting_style = true;
+ break;
+ }
+ }
+ if (need_quoting_style)
getenv_quoting_style ();
format2 = format;
}
EOF
compare exp out || fail=1
+# Check the behavior with invalid values of QUOTING_STYLE.
+for style in '' 'abcdef'; do
+ QUOTING_STYLE="$style" stat -c%N \' > out 2> err || fail=1
+ cat <<\EOF > exp-out || framework_failure_
+"'"
+EOF
+ cat <<EOF > exp-err || framework_failure_
+stat: ignoring invalid value of environment variable QUOTING_STYLE: '$style'
+EOF
+ compare exp-out out || fail=1
+ compare exp-err err || fail=1
+ # coreutils-9.10 and earlier would unnecessarily check QUOTING_STYLE in
+ # these cases.
+ for format in '%%N' 'abc%%Ndef' 'abc%%Ndef%%N'; do
+ QUOTING_STYLE="$style" stat -c"$format" \' > out 2> err || fail=1
+ printf "$format\n" > exp-out || framework_failure_
+ compare exp-out out || fail=1
+ compare /dev/null err || fail=1
+ done
+done
+
+# Check the behavior with %N following %%N.
+stat -cabc%%Ndef%N \' > out || fail=1
+QUOTING_STYLE=locale stat -cabc%%Ndef%N \' >> out || fail=1
+cat <<\EOF >exp
+abc%Ndef"'"
+abc%Ndef'\''
+EOF
+compare exp out || fail=1
+
# ensure %H and %L modifiers are handled
stat -c '%r %R %Hd,%Ld %Hr,%Lr' . > out || fail=1
grep -F '?' out && fail=1