]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
wc: fix -w with breaking space over UCHAR_MAX
authorAearil <aearil@paranoici.org>
Sat, 24 Feb 2024 20:44:24 +0000 (21:44 +0100)
committerPádraig Brady <P@draigBrady.com>
Mon, 26 Feb 2024 17:33:02 +0000 (17:33 +0000)
* src/wc.c (wc): Fix regression introduced in commit v9.4-48-gf40c6b5cf.
* tests/wc/wc-nbsh.sh: Add test cases for "standard" spaces.
Fixes https://bugs.gnu.org/69369

src/wc.c
tests/wc/wc-nbsp.sh

index f5a921534cc7f7451bbcb6be04107ba4bca21810..d70ad39363e860632a29c68a34aa7fc4f53dc62d 100644 (file)
--- a/src/wc.c
+++ b/src/wc.c
@@ -528,7 +528,8 @@ wc (int fd, char const *file_x, struct fstatus *fstatus, off_t current_pos)
                           if (width > 0)
                             linepos += width;
                         }
-                      in_word2 = !iswnbspace (wide_char);
+                      in_word2 = ! iswspace (wide_char)
+                                 && ! iswnbspace (wide_char);
                     }
 
                   /* Count words by counting word starts, i.e., each
index 371cc8b5b1b39c92b43b648eef0d079dfdfd60b6..39a8baccc6f4d04a519b88043d7e624c93db7220 100755 (executable)
@@ -38,10 +38,15 @@ fi
 
 export LC_ALL=en_US.UTF-8
 if test "$(locale charmap 2>/dev/null)" = UTF-8; then
+  #non breaking space class
   check_word_sep '\u00A0'
   check_word_sep '\u2007'
   check_word_sep '\u202F'
   check_word_sep '\u2060'
+
+  #sampling of "standard" space class
+  check_word_sep '\u0020'
+  check_word_sep '\u2003'
 fi
 
 export LC_ALL=ru_RU.KOI8-R