On 9/17/17 6:01 AM, Stephane Chazelas wrote:
> $ locale charmap
> UTF-8
> $ bash -c '"$@"' sh printf '%d\n' $'"\xff' $'"\xff' $'"\xff'
> 32767
> 0
> 0
>
> That's because we store the return value of mblen() (which may be
> -1) into a size_t (unsigned) variable.
>
> See patch below which aligns th
On 9/16/17 11:16 PM, Robert Elz wrote:
> Now to the philosophical ... I agree with the aims of free software, but
> I believe that should be interpreted correctly - that is, if software is
> free, it should impose no restrictions at all upon is recipients, which
> includes hidden "you should recip
2017-09-17 11:01:00 +0100, Stephane Chazelas:
[...]
>wchar_t wc;
> - size_t mblength, slen;
> + int mblength;
[...]
> + mblength = mbtowc (&wc, garglist->word->word+1, slen);
> + if (mblength > 0)
> +ch = wc;
[...]
Actually, "wc" should probably be initialised to 0 to cover for
cases w
Sorry, subject was wrong. The behaviour is OK in the C locale.
--
Stephane
$ locale charmap
UTF-8
$ bash -c '"$@"' sh printf '%d\n' $'"\xff' $'"\xff' $'"\xff'
32767
0
0
That's because we store the return value of mblen() (which may be
-1) into a size_t (unsigned) variable.
See patch below which aligns the behaviour with that of other
shells which use the byte value when