On 24.08.2016 22:03, Ingo Schwarze wrote:
>> Could you show some code? In my testing fgetwln() fails on next read if
>> previously there was partial line with tail EILSEQ. Stdio not advance
>> its pointer over the sequence with EILSEQ.
> 
> See below for a radically stripped down version of FreeBSD rev(1).
> When i revert my fgetwln(3) patch (as you did in FreeBSD) and compile
> and run that stripped down rev(1) on OpenBSD, i get this:
> 
>    $ export LC_CTYPE=en_US.UTF-8
>    $ printf "one\200two\200three" | ./frev 
>   eno
>   owt
>   eerht
>   frev: Illegal byte sequence
> 
> Is there maybe yet another bug, maybe somewhere in OpenBSD fgetwc(3),
> advancing a pointer where it shouldn't?  What result do you see
> when you run that test program on FreeBSD?

Even on FreeBSD stable/10 I got different (i.e. correct) results:

$ export LC_CTYPE=en_US.UTF-8
$ printf "one\200two\200three" | ./frev
eno
frev: Illegal byte sequence

It stops on the first \200 as it should.

Reply via email to