This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: patch: Add test for international currency formatting


[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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]