This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: patch: Add test for international currency formatting
- From: Petter Reinholdtsen <pere at hungry dot com>
- To: "Joseph S. Myers" <jsm28 at cam dot ac dot uk>
- Cc: libc-alpha at sources dot redhat dot com
- Date: 30 Dec 2003 01:11:42 +0100
- Subject: Re: patch: Add test for international currency formatting
- References: <E19ThdX-0007uw-00@minerva.hungry.com><Pine.LNX.4.53.0306211653160.13481@kern.srcf.societies.cam.ac.uk>
- Reply-by: Tue, 1 Jan 1801 04:37:40 +1000
[Joseph S. Myers, 2003-06-21]
> If you're looking at strfmon in general: there are, or were, cases where
> left-justification ('-' flag) is handled improperly. (Some Austin Group
> drafts were unclear in the specification; I submitted reports of the
> problem with the drafts and the specification was clarified to follow the
> cleaner interpretation of Solaris rather than that of glibc. I don't
> think glibc has subsequently been fixed to follow the specification. The
> drafts used to say "all fields are left-justified" and this was fixed to
> "the result of the conversion is left-justified", and it is now specified
> that this flag is ignored unless a field width is specified. Testcases in
> the examples in the standard
> <http://www.opengroup.org/onlinepubs/007904975/functions/strfmon.html> and
> in the original Austin Group comments
> <http://www.opengroup.org/austin/docs/austin_77r2.txt>.)
I have been looking into this for a while, and tried to understand how
strfmon() was actually working.
I believe the fix for this problem is the following patch, but have to
check it some more for side effects.
I post it here to let you know about the possible fix. I'll post a
proper patch (some of the tests need to be changed as well), when I am
sure I understand all effects of this patch.
When this problem is fixed, I believe the only problem left is a bug
in the standard examples and not in glibc. See
<URL:http://sources.redhat.com/ml/libc-alpha/2003-09/msg00163.html>
for the details.
Index: strfmon.c
===================================================================
RCS file: /cvs/glibc/libc/stdlib/strfmon.c,v
retrieving revision 1.24
diff -u -3 -p -u -r1.24 strfmon.c
--- strfmon.c 5 Dec 2003 09:50:14 -0000 1.24
+++ strfmon.c 30 Dec 2003 00:02:52 -0000
@@ -570,7 +573,7 @@ __strfmon_l (char *s, size_t maxsize, __
info.is_long = 0;
info.alt = 0;
info.space = 0;
- info.left = left;
+ info.left = 0;
info.showsign = 0;
info.group = group;
info.pad = pad;