fprintf() crashes on wide-oriented stream.
Jeff Johnston
jjohnstn@redhat.com
Wed Oct 4 20:16:13 GMT 2023
Hi Takashi,
I finally took a look at this. The issue is whether POSIX compliance is
desired. Corinna would have
strong opinions that it is desired and thus, I think she should have her
say when she gets back. I personally believe that
newlib should have behaved like glibc. I also think the test snippet is
invalid and should have performed an fwide call on stdout
to reset the wide-orientation and have the code work properly in all cases.
-- Jeff J.
On Wed, Sep 27, 2023 at 11:58 PM Takashi Yano <takashi.yano@nifty.ne.jp>
wrote:
> On Tue, 26 Sep 2023 12:41:47 +0900
> Takashi Yano wrote:
> > With this patch, __sfputs_r/__sprint_r is split into two versions, one
> > is for vfprintf which does not handle wide string, and the other (newly
> > introduced __sfputws_r/__swprin_r) is for vfwprintf which handles wide
> > string. Please note that fprintf gets working for wide orient stream
> > just like BSD libc, which behaves differently from GNU libc.
>
> I confirmed musl libc also behaves as BSD libc.
>
> In the GNU libc (glibc), fprintf() returns -1 with no errno set if the
> stream is wide-oriented.
>
> --
> Takashi Yano <takashi.yano@nifty.ne.jp>
>
>
More information about the Newlib
mailing list