Subject: MirBSD 10 i386 test failures [Re: grep-2.24.13-bed6 feedback

From: Jim Meyering <[email-masked]>
Date: Sun, 17 Apr 2016 22:45:13 -0700

[Nelson H. F. Beebe ran many tests and reported
the results privately ]

Thank you for the testing and reporting the results.
I was about to make the release when I saw your email.

Here's the first failure I have investigated:

+ tr2='\200'
+ echo X
+ tr X '\200'
+ LC_ALL=C
+ env -- tr X '\200'
++ wc -l
+ test 1 -eq 1
+ grep . in
+ fail=1
+ compare in out
+ compare_dev_null_ in out
+ test 2 = 2
+ test xin = x/dev/null
+ test xout = x/dev/null
+ return 2
+ case $? in
+ compare_ in out
+ diff -u in out
--- in  2016-04-15 13:19:50.797357000 -0600
+++ out 2016-04-15 13:19:50.797357000 -0600
@@ -1 +0,0 @@
-<80>
+ fail=1
...
FAIL c-locale (exit status: 1)

The failure is due to mirbsd's btowc, which is used in dfa.c for these:

/* Add this to the test for whether a byte is word-constituent, since on
   BSD-based systems, many values in the 128..255 range are classified as
   alphabetic, while on glibc-based systems, they are not.  */
#ifdef __GLIBC__
# define is_valid_unibyte_character(c) 1
#else
# define is_valid_unibyte_character(c) (btowc (c) != WEOF)
#endif

/* C is a "word-constituent" byte.  */
#define IS_WORD_CONSTITUENT(C) \
  (is_valid_unibyte_character (C) && (isalnum (C) || (C) == '_'))

The following two tables show the I for which btowc(I) == WEOF and for
which gnulib's btowc.c meet that same condition on mirbsd:

mirbsd$ LC_CTYPE=C LC_ALL=C ./a.out|fmt
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229
230 231 232 233 234 235 236 237 238 239
mirbsd$ gcc btowc-test.c
mirbsd$ LC_CTYPE=C LC_ALL=C ./a.out|fmt
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253
254 255
mirbsd$ uname -a
MirBSD mirbsd.vm.math.utah.edu 10 GENERIC#1359 i386 i386 AMD
Opteron(tm) Processor 6136 ("AuthenticAMD" 686-class, 512KB L2 cache)
MirBSD
mirbsd$ LC_ALL=C locale
LANG=
LC_CTYPE="en_US.UTF-8"
LC_COLLATE="C"
LC_TIME="C"
LC_NUMERIC="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_ALL=C

==========================
Normally, I would specify only LC_ALL=C,
but when I saw that the above invocation of
locale failed to set LC_CTYPE to "C". Explicitly
setting LC_CTYPE didn't make a difference.

Those differences lead to different "trans" (transition) tables in
dfa.c, and make dfaexec declare that "." does not match \200.

Conclusion: we'll have to make btowc work properly in the C locale, too.