Subject: bug#14463: coreutils-8.21 darwin regressions

From: Jack Howarth <[email-masked]>
Date: Fri, 24 May 2013 18:46:35 -0400

On Fri, May 24, 2013 at 10:37:55AM -0700, Paul Eggert wrote:
> On 05/24/2013 06:09 AM, Jack Howarth wrote:
> >    I am finding on x86_64-apple-darwin12 that coreutils 8.21 exhibits four additional failures in gnulib-tests
> > which aren't present in a build of coreutils 8.19. These are...
> 
> > test-getgroups.c:58: assertion failed
> 
> Thanks, this makes it looks like Darwin getgroups (n, array)
> isn't returning -1 when the user is in more than n groups.
> I see from the manual that the Darwin has two getgroups
> implementations, one when you define _DARWIN_UNLIMITED_GETGROUPS or
> _DARWIN_C_SOURCE, and one when you don't.  Which one are you
> using, and why?  And does the one you're using have the
> above-described property?  If so, I suppose Gnulib could
> be modified to work around the POSIX incompatibility.

It obviously wlll be using _DARWIN_C_SOURCE because that is what you test for in
m4/extensions.m4 with...

AC_DEFINE([_DARWIN_C_SOURCE])

The following posting from bugs.python.org seems to discuss this same issue...

http://mail.python.org/pipermail/python-bugs-list/2010-February/092780.html

The proposed fix there was to revert _DARWIN_C_SOURCE locally in only posixmodule.c.
I tried changing the instances of _DARWIN_C_SOURCE to _POSIX_C_SOURCE in configure, lib/config.hin
and m4/extensions.m4 but that build fails with...

  CC     lib/fts.o
lib/freadahead.c:91:3: error: "Please port gnulib freadahead.c to your platform! Look at the definition of fflush, fread, ungetc on your system, then
      report this to bug-gnulib."
 #error "Please port gnulib freadahead.c to your platform! Look at the definition of fflush, fread, ungetc on your system, then report this to bug-gnulib."
  ^
1 error generated.
lib/freadptr.c:116:3: error: "Please port gnulib freadptr.c to your platform! Look at the definition of fflush, fread, getc, getc_unlocked on your system,
      then report this to bug-gnulib."
make[2]: *** [lib/freadahead.o] Error 1
make[2]: *** Waiting for unfinished jobs....
 #error "Please port gnulib freadptr.c to your platform! Look at the definition of fflush, fread, getc, getc_unlocked on your system, then report...
  ^
1 error generated.
make[2]: *** [lib/freadptr.o] Error 1
lib/fseterr.c:77:3: error: "Please port gnulib fseterr.c to your platform! Look at the definitions of ferror and clearerr on your system, then report this
      to bug-gnulib."
 #error "Please port gnulib fseterr.c to your platform! Look at the definitions of ferror and clearerr on your system, then report this to bug-gnulib."
  ^
1 error generated.
lib/fseeko.c:103:4: error: "Please port gnulib fseeko.c to your platform! Look at the code in fpurge.c, then report this to bug-gnulib."
  #error "Please port gnulib fseeko.c to your platform! Look at the code in fpurge.c, then report this to bug-gnulib."
   ^
1 error generated.
make[2]: *** [lib/fseterr.o] Error 1
make[2]: *** [lib/fseeko.o] Error 1
lib/fts.c:1217:10: error: use of undeclared identifier 'DT_BLK'
    case DT_BLK:
         ^
lib/fts.c:1220:10: error: use of undeclared identifier 'DT_CHR'
    case DT_CHR:
         ^
lib/fts.c:1223:10: error: use of undeclared identifier 'DT_DIR'
    case DT_DIR:
         ^
lib/fts.c:1226:10: error: use of undeclared identifier 'DT_FIFO'
    case DT_FIFO:
         ^
lib/fts.c:1229:10: error: use of undeclared identifier 'DT_LNK'
    case DT_LNK:
         ^
lib/fts.c:1232:10: error: use of undeclared identifier 'DT_REG'
    case DT_REG:
         ^
lib/fts.c:1235:10: error: use of undeclared identifier 'DT_SOCK'
    case DT_SOCK:
         ^
lib/fts.c:1532:46: error: use of undeclared identifier 'DT_UNKNOWN'
                                          && DT_IS_KNOWN(dp)
                                             ^
lib/fts.c:88:41: note: expanded from macro 'DT_IS_KNOWN'
# define DT_IS_KNOWN(d) ((d)->d_type != DT_UNKNOWN)
                                        ^
lib/fts.c:1533:63: error: use of undeclared identifier 'DT_DIR'
                                          && ! DT_MUST_BE(dp, DT_DIR));
                                                              ^
lib/fts.c:90:44: note: expanded from macro 'DT_MUST_BE'
# define DT_MUST_BE(d, t) ((d)->d_type == (t))
                                           ^
lib/fts.c:1540:53: error: use of undeclared identifier 'DT_DIR'
                                  && DT_MUST_BE(dp, DT_DIR));
                                                    ^
lib/fts.c:90:44: note: expanded from macro 'DT_MUST_BE'
# define DT_MUST_BE(d, t) ((d)->d_type == (t))
                                           ^
10 errors generated.

≈
> 
> > test-getlogin.c:69: assertion failed
> 
> What are the values of 'buf' and of 'name' there, and why?
> 
> > The full trace for the test-vasprintf-posix test case is rather large and is attached as a gzip file.
> 
> It's failing here:
> 
> 
>   { /* Rounding near the decimal point.  */
>     char *result;
>     int retval =
>       my_asprintf (&result, "%.0a %d", 1.5, 33, 44, 55);
>     ASSERT (result != NULL);
>     ASSERT (strcmp (result, "0x1p+0 33") == 0
>             || strcmp (result, "0x2p+0 33") == 0
>             || strcmp (result, "0x3p-1 33") == 0
>             || strcmp (result, "0x6p-2 33") == 0
>             || strcmp (result, "0xcp-3 33") == 0);
>     ASSERT (retval == strlen (result));
>     free (result);
>   }
> 
> Can you run GDB on that and see what the value of 'result' is?
> Most likely it's just the Apple sprintf messing up.
> 
> You mentioned a getcwd problem, but I didn't see any
> more details....
> 
>