bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: printf failure on darwin with coreutils-6.9.91


From: Jim Meyering
Subject: Re: printf failure on darwin with coreutils-6.9.91
Date: Mon, 07 Jan 2008 23:47:53 +0100

Peter Fales <address@hidden> wrote:

> I'm trying to build coreutils-6.9.91 for Mac OS/X (Darwin 10.3)
> and getting test failures from misc/printf.   The output of make check
> is attached below.   I believe the problem occurs around line 345 of
> src/printf.c which has:
>
> 342      switch (conversion)
> 343        {
> 344        case 'd': case 'i': case 'o': case 'u': case 'x': case 'X':
> 345          length_modifier = PRIdMAX;
> 346          length_modifier_len = sizeof PRIdMAX - 2;
> 347          break;
>
> On linux PRIdMAX is defined as "lld" but on darwin it is defined as "qd".
> Later on in the block of code around line 331 in lib/parse-printf.c, the
> 'q' case is not handled.
>
> Here's the test log:
>
> make  check-TESTS
> make[1]: Entering directory 
> `/Volumes/UFS_exp2/exptools/expmake/build/gnucoresrc/build/coreutils/tests/misc'
> make[2]: Entering directory 
> `/Volumes/UFS_exp2/exptools/expmake/build/gnucoresrc/build/coreutils/tests/misc'
> FAIL: printf.log

Based on your diagnosis, maybe this patch solves the problem?
[beware: I haven't investigated enough to know if 'qd' goes where
 this patch puts it, or if it goes with the 'l' a few lines above]

diff --git a/lib/printf-parse.c b/lib/printf-parse.c
index e3aa95a..4b95cb9 100644
--- a/lib/printf-parse.c
+++ b/lib/printf-parse.c
@@ -1,5 +1,5 @@
 /* Formatted output to strings.
-   Copyright (C) 1999-2000, 2002-2003, 2006-2007 Free Software Foundation, Inc.
+   Copyright (C) 1999-2000, 2002-2003, 2006-2008 Free Software Foundation, Inc.

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -347,7 +347,7 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, 
arguments *a)
                      flags += 8;
                      cp++;
                    }
-                 else if (*cp == 'j')
+                 else if (*cp == 'j' || *cp == 'q')
                    {
                      if (sizeof (intmax_t) > sizeof (long))
                        {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]