diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2016-09-19 12:36:18 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2016-09-19 12:48:32 -0700 |
commit | 1db94ee969b984bbd00b97c6abbe2f69db8e0000 (patch) | |
tree | fcd52754a6a4337e07e4996cb6cf37939e2655f0 /NEWS | |
parent | e0953783024a113b186547aca186777f9ce3b798 (diff) | |
download | coreutils-1db94ee969b984bbd00b97c6abbe2f69db8e0000.tar.xz |
ls: fix %%b format and precompute more
The old code mishandled --time-spec='+%%b', as it misinterpreted
the '%b' as being the month abbreviation. Also, it mishandled
the extremely unlikely case of a month abbreviation containing '%'.
The performance part of this patch sped up 'ls' by about 1% on my
little benchmark of 'ls -lR' on the source directory in the
en_US.UTF-8 locale (Fedora 24 x86-64).
* NEWS: Document the bug fix.
* src/ls.c (first_percent_b, abformat_init): New static functions.
(ABFORMAT_SIZE): New constant.
(use_abformat): New static var.
(abmon, required_mon_width): Remove these static vars.
(abmon_init): Now accepts a pointer to abmon, and returns a boolean.
All callers changed. Reject month abbrs containing '%', as these
would mess up strftime. Simplify mbsalign result checking,
since (size_t) -1 exceeds ABFORMAT_SIZE.
(abformat_init, align_nstrftime): Precompute all 24 formats at
startup, rather than computing a format for each time stamp.
(decode_switches): Call abformat_init instead of abmon_init.
(align_nstrftime): Accept recentness bool instead of format.
All callers changed.
* tests/misc/time-style.sh: Test for format with '%%b'.
Diffstat (limited to 'NEWS')
-rw-r--r-- | NEWS | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -25,6 +25,9 @@ GNU coreutils NEWS -*- outline -*- factor again outputs immediately when numbers are input interactively. [bug introduced in coreutils-8.24] + ls --time-style no longer mishandles '%%b' in formats. + [bug introduced in coreutils-7.2] + nl now resets numbering for each page section rather than just for each page. [This bug was present in "the beginning".] |