Re: bug in fputwc(3) error reporting

2016-01-23 Thread Ingo Schwarze
Hi, Ingo Schwarze wrote on Sun, Jan 10, 2016 at 10:22:28PM +0100: > Todd C. Miller wrote on Sun, Jan 10, 2016 at 12:33:07PM -0700: >> On Sun, 10 Jan 2016 19:55:53 +0100, Ingo Schwarze wrote: >>> So, my conclusion is that it's the C standard that is carelessly >>> worded, not POSIX. I don't

Re: bug in fputwc(3) error reporting

2016-01-23 Thread Todd C. Miller
On Sat, 23 Jan 2016 21:14:24 +0100, Ingo Schwarze wrote: > In conclusion, i would consider it a very bad idea to change all the > operating systems to not set the error indicator, violating POSIX > and making correct coding harder, just to please the not very nice > C standard, then possibly

Re: bug in fputwc(3) error reporting

2016-01-23 Thread Ted Unangst
Ingo Schwarze wrote: > Consequently, i propose to not revert our fgetwc(3) patch and to > commit this fputwc(3) patch, too, making us agree with FreeBSD, > NetBSD, Dragonfly, SunOS, glibc, and POSIX, even tough nominally > violating the C standard (but in a way that seems less dangerous > than the

Re: bug in fputwc(3) error reporting

2016-01-10 Thread Ingo Schwarze
Hi, Ted Unangst wrote on Wed, Dec 30, 2015 at 01:22:17AM -0500: > Philip Guenther wrote: >> On Tue, Dec 29, 2015 at 2:34 PM, Todd C. Miller wrote: >>> Since POSIX defers to ISO C we should be following the ISO C standard >>> with respect to behavior when an encoding error occurs. As such, >>>

Re: bug in fputwc(3) error reporting

2016-01-10 Thread Todd C. Miller
On Sun, 10 Jan 2016 19:55:53 +0100, Ingo Schwarze wrote: > So, my conclusion is that it's the C standard that is carelessly > worded, not POSIX. I don't think the C standard intends to say > that fgetwc(3) and fputwc(3) are not allowed to set the error > indicator on an encoding error, it just

Re: bug in fputwc(3) error reporting

2016-01-10 Thread Ingo Schwarze
Hi Todd, Todd C. Miller wrote on Sun, Jan 10, 2016 at 12:33:07PM -0700: > On Sun, 10 Jan 2016 19:55:53 +0100, Ingo Schwarze wrote: >> So, my conclusion is that it's the C standard that is carelessly >> worded, not POSIX. I don't think the C standard intends to say >> that fgetwc(3) and

Re: bug in fputwc(3) error reporting

2015-12-29 Thread Philip Guenther
On Tue, Dec 29, 2015 at 2:34 PM, Todd C. Miller wrote: ... > Since POSIX defers to ISO C we should be following the ISO C standard > with respect to behavior when an encoding error occurs. As such, > I've changed my mind and now believe we should not be setting the >

Re: bug in fputwc(3) error reporting

2015-12-29 Thread Todd C. Miller
On Sun, 27 Dec 2015 00:42:52 +0100, =?utf-8?Q?J=C3=A9r=C3=A9mie_Courr=C3=A8ges- Anglas?= wrote: > The way I read it, [CX] here only affects the last part of the sentence, > > "and errno shall be set to indicate the error." > > (because the C standard doesn't require errno to be set in all

Re: bug in fputwc(3) error reporting

2015-12-29 Thread Ted Unangst
Philip Guenther wrote: > On Tue, Dec 29, 2015 at 2:34 PM, Todd C. Miller > wrote: > ... > > Since POSIX defers to ISO C we should be following the ISO C standard > > with respect to behavior when an encoding error occurs. As such, > > I've changed my mind and now

Re: bug in fputwc(3) error reporting

2015-12-28 Thread Todd C. Miller
OK millert@. I believe there are also instances of the same problem in the non-wide code. In fact, we don't even document that the error indicator is set in putc(3)! Someone else may wish to tackle that one :-) - todd

Re: bug in fputwc(3) error reporting

2015-12-26 Thread Jérémie Courrèges-Anglas
Ingo Schwarze writes: [...] > When fputwc(3) encounters an encoding error, it neglects to set the > error indicator, just like fgetwc(3) did before i fixed it today. > Setting the error indicator is required by the manual and by the > standard. Hmm, the C standard and POSIX

Re: bug in fputwc(3) error reporting

2015-12-26 Thread Anthony J. Bentley
Hi Jérémie, Jérémie Courrèges-Anglas writes: > Hmm, the C standard and POSIX have slightly different texts regarding > this. > > Quoting POSIX-2013: > -->8-- > RETURN VALUE > > Upon successful completion, fputwc() shall return wc. Otherwise, it > shall return WEOF, the error indicator

Re: bug in fputwc(3) error reporting

2015-12-26 Thread Jérémie Courrèges-Anglas
"Anthony J. Bentley" writes: > Hi Jérémie, Hi, > Jérémie Courrèges-Anglas writes: >> Hmm, the C standard and POSIX have slightly different texts regarding >> this. >> >> Quoting POSIX-2013: >> -->8-- >> RETURN VALUE >> >> Upon successful completion, fputwc() shall

bug in fputwc(3) error reporting

2015-12-24 Thread Ingo Schwarze
Third file, third bug. SO FAR, EACH AND EVERY BLOODY PLACE I LOOKED AT WAS BROKEN. When fputwc(3) encounters an encoding error, it neglects to set the error indicator, just like fgetwc(3) did before i fixed it today. Setting the error indicator is required by the manual and by the standard.