From 44ebc669353b5fe5b8a419ec71efc6c9b8d03685 Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: May 29 2018 15:02:58 +0000 Subject: Resolves: #1577872 - ls: increase the allowed abmon width from 5 to 12 --- diff --git a/coreutils-8.29-ls-abmon-width.patch b/coreutils-8.29-ls-abmon-width.patch new file mode 100644 index 0000000..1022f01 --- /dev/null +++ b/coreutils-8.29-ls-abmon-width.patch @@ -0,0 +1,69 @@ +From 5a820c5a312d6a5b7a1a755cd0f81c84f7c676d7 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?P=C3=A1draig=20Brady?= +Date: Wed, 14 Mar 2018 11:31:43 -0700 +Subject: [PATCH] ls: increase the allowed abmon width from 5 to 12 + +This will impact relatively few languages, +and will make Arabic or Catalan etc. +output unambiguous abbreviated month names. + +* src/ls.c (MAX_MON_WIDTH): Increase from 5 to 12. +* tests/ls/abmon-align.sh: Augment to check for ambiguous output. +Fixes https://bugs.gnu.org/30814 + +Upstream-commit: 5ed2018360ba44f673b1dc74fb3d2927f7fcfae3 +Signed-off-by: Kamil Dudka +--- + src/ls.c | 7 +++++-- + tests/ls/abmon-align.sh | 9 ++++++--- + 2 files changed, 11 insertions(+), 5 deletions(-) + +diff --git a/src/ls.c b/src/ls.c +index 4becd06..b2983aa 100644 +--- a/src/ls.c ++++ b/src/ls.c +@@ -1095,8 +1095,11 @@ file_escape_init (void) + variable width abbreviated months and also precomputing/caching + the names was seen to increase the performance of ls significantly. */ + +-/* max number of display cells to use */ +-enum { MAX_MON_WIDTH = 5 }; ++/* max number of display cells to use. ++ As of 2018 the abmon for Arabic has entries with width 12. ++ It doesn't make much sense to support wider than this ++ and locales should aim for abmon entries of width <= 5. */ ++enum { MAX_MON_WIDTH = 12 }; + /* abformat[RECENT][MON] is the format to use for timestamps with + recentness RECENT and month MON. */ + enum { ABFORMAT_SIZE = 128 }; +diff --git a/tests/ls/abmon-align.sh b/tests/ls/abmon-align.sh +index e474047..a81266b 100755 +--- a/tests/ls/abmon-align.sh ++++ b/tests/ls/abmon-align.sh +@@ -32,17 +32,20 @@ for format in "%b" "[%b" "%b]" "[%b]"; do + # The sed usage here is slightly different from the original, + # removing the \(.*\), to avoid triggering misbehavior in at least + # GNU sed 4.2 (possibly miscompiled) on Mac OS X (Darwin 9.8.0). +- n_widths=$( ++ months="$( + LC_ALL=$LOC TIME_STYLE=+"$format" ls -lgG *.ts | +- LC_ALL=C sed 's/.\{15\}//;s/ ..\.ts$//;s/ /./g' | ++ LC_ALL=C sed 's/.\{15\}//;s/ ..\.ts$//;s/ /./g')" ++ n_widths=$(echo "$months" | + while read mon; do echo "$mon" | LC_ALL=$LOC wc -L; done | + uniq | wc -l + ) ++ n_dupes=$(echo "$months" | sort | uniq -d | wc -l) + test "$n_widths" = "1" || { fail=1; break 2; } ++ test "$n_dupes" = "0" || { fail=1; break 2; } + done + done + if test "$fail" = "1"; then +- echo "misalignment detected in $LOC locale:" ++ echo "misalignment or ambiguous output in $LOC locale:" + LC_ALL=$LOC TIME_STYLE=+%b ls -lgG *.ts + fi + +-- +2.14.3 + diff --git a/coreutils.spec b/coreutils.spec index 61611fc..28c8f2e 100644 --- a/coreutils.spec +++ b/coreutils.spec @@ -30,6 +30,9 @@ Patch4: coreutils-8.29-fts-leaf-opt.patch # date, ls: pick strftime fixes from glibc to improve locale support (#1577872) Patch5: coreutils-8.29-gnulib-strftime.patch +# ls: increase the allowed abmon width from 5 to 12 (#1577872) +Patch6: coreutils-8.29-ls-abmon-width.patch + # disable the test-lock gnulib test prone to deadlock Patch100: coreutils-8.26-test-lock.patch @@ -281,6 +284,7 @@ fi %changelog * Mon May 28 2018 Kamil Dudka - 8.29-11 +- ls: increase the allowed abmon width from 5 to 12 (#1577872) - date, ls: pick strftime fixes from glibc to improve locale support (#1577872) * Fri Apr 20 2018 Kamil Dudka - 8.29-10