This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[Patch][BZ 6530] *printf and incomplete multibyte sequences returns-1 bogusly
- From: Jeff Law <law at redhat dot com>
- To: libc-alpha <libc-alpha at sourceware dot org>
- Date: Mon, 01 Oct 2012 14:58:30 -0600
- Subject: [Patch][BZ 6530] *printf and incomplete multibyte sequences returns-1 bogusly
Attached is the patch I checked in to fix BZ 6530.
As mentioned in the BZ, comment #6 C99 conformance demands:
If no l length modifier is present, the argument shall be a pointer to
the initial element of an array of character type.246) [...] If an l
length modifier is present, the argument shall be a pointer to the
initial element of an array of wchar_t type.
246) No special provisions are made for multibyte characters.
So a format string such as %.50s, the string must be treated as an array
of chars. Returning an error because the string isn't a valid UTF-8
sequence isn't right according to the standard.
The patch simply removes the unwanted code which tried to treat the
string like multibyte chars. The patch to remove the unwanted code is
originally from Andreas Schwab and we've been using it to avoid this
problem in Fedora for about two years now.
Jonathan Nieder cobbled together the necessary changes to the testsuite
to test for this problem.
All I've done is combine those two changes into a single patch along
with the usual NEWS update.
I verified that Jonathan's test fails when installed without Andreas's
patch and that after Andreas's patch the test succeeds. I observed no
regressions when testing.
Attachment:
P
Description: Text document