GNU bug report logs - #20923
mgetgroups.c vs getgrouplist warning on OS X

Previous Next

Package: coreutils;

Reported by: Jim Meyering <jim <at> meyering.net>

Date: Sun, 28 Jun 2015 23:43:02 UTC

Severity: normal

Tags: fixed

Done: Assaf Gordon <assafgordon <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 20923 in the body.
You can then email your comments to 20923 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#20923; Package coreutils. (Sun, 28 Jun 2015 23:43:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jim Meyering <jim <at> meyering.net>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Sun, 28 Jun 2015 23:43:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: bug-coreutils <at> gnu.org
Subject: mgetgroups.c vs getgrouplist warning on OS X
Date: Sun, 28 Jun 2015 16:41:42 -0700
I compiled the just-published snapshot on OS X configured with
--enable-gcc-warnings, and saw this:

lib/mgetgroups.c: In function 'mgetgroups':
lib/mgetgroups.c:90:45: error: pointer targets in passing argument 3
of 'getgrouplist' differ in signedness [-Werror=pointer-sign]
           ng = getgrouplist (username, gid, g, &max_n_groups);
                                             ^




Information forwarded to bug-coreutils <at> gnu.org:
bug#20923; Package coreutils. (Mon, 29 Jun 2015 06:49:02 GMT) Full text and rfc822 format available.

Message #8 received at 20923 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Jim Meyering <jim <at> meyering.net>, 20923 <at> debbugs.gnu.org
Cc: Gnulib bugs <bug-gnulib <at> gnu.org>
Subject: Re: bug#20923: mgetgroups.c vs getgrouplist warning on OS X
Date: Sun, 28 Jun 2015 23:48:01 -0700
[Message part 1 (text/plain, inline)]
Jim Meyering wrote:
> I compiled the just-published snapshot on OS X configured with
> --enable-gcc-warnings, and saw this:
>
> lib/mgetgroups.c: In function 'mgetgroups':
> lib/mgetgroups.c:90:45: error: pointer targets in passing argument 3
> of 'getgrouplist' differ in signedness [-Werror=pointer-sign]
>             ng = getgrouplist (username, gid, g, &max_n_groups);

Does the attached gnulib patch fix things for you on OS X?

Its documentation lists OS X 10.11 (released this month), as I assume the 
incompatiblity is in the latest version of OS X and that Apple's never going to 
fix it....
[0001-mgetgroups-port-to-strict-OS-X.patch (text/x-diff, attachment)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#20923; Package coreutils. (Mon, 29 Jun 2015 17:50:02 GMT) Full text and rfc822 format available.

Message #11 received at 20923 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: Gnulib bugs <bug-gnulib <at> gnu.org>, 20923 <at> debbugs.gnu.org
Subject: Re: bug#20923: mgetgroups.c vs getgrouplist warning on OS X
Date: Mon, 29 Jun 2015 10:48:42 -0700
On Sun, Jun 28, 2015 at 11:48 PM, Paul Eggert <eggert <at> cs.ucla.edu> wrote:
> Jim Meyering wrote:
>>
>> I compiled the just-published snapshot on OS X configured with
>> --enable-gcc-warnings, and saw this:
>>
>> lib/mgetgroups.c: In function 'mgetgroups':
>> lib/mgetgroups.c:90:45: error: pointer targets in passing argument 3
>> of 'getgrouplist' differ in signedness [-Werror=pointer-sign]
>>             ng = getgrouplist (username, gid, g, &max_n_groups);
>
>
> Does the attached gnulib patch fix things for you on OS X?
>
> Its documentation lists OS X 10.11 (released this month), as I assume the
> incompatiblity is in the latest version of OS X and that Apple's never going
> to fix it....

Hi Paul,
Thanks for writing that, but it did not help: the first variant compiled
just fine here (and probably everywhere),
so HAVE_GETGROUPLIST_WITH_INT was not defined.

The problem arises only when using --enable-gcc-warnings and the prototype-
required int* (type of argument 3) conflicts with the gid_t* argument.




Information forwarded to bug-coreutils <at> gnu.org:
bug#20923; Package coreutils. (Mon, 29 Jun 2015 18:41:02 GMT) Full text and rfc822 format available.

Message #14 received at 20923 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Jim Meyering <jim <at> meyering.net>
Cc: Gnulib bugs <bug-gnulib <at> gnu.org>, 20923 <at> debbugs.gnu.org
Subject: Re: bug#20923: mgetgroups.c vs getgrouplist warning on OS X
Date: Mon, 29 Jun 2015 11:39:49 -0700
[Message part 1 (text/plain, inline)]
Jim Meyering wrote:
> the first variant compiled
> just fine here (and probably everywhere),
> so HAVE_GETGROUPLIST_WITH_INT was not defined.

Yes, well, it did work on GNU/Linux, which is what I tested it on.....

How about if we make the check pickier, so that it is likely to be triggered 
even without --enable-gcc-warnings, as in the attached?
[0001-mgetgroups-port-to-strict-OS-X.patch (text/x-diff, attachment)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#20923; Package coreutils. (Mon, 29 Jun 2015 21:03:01 GMT) Full text and rfc822 format available.

Message #17 received at 20923 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: Gnulib bugs <bug-gnulib <at> gnu.org>, 20923 <20923 <at> debbugs.gnu.org>
Subject: Re: bug#20923: mgetgroups.c vs getgrouplist warning on OS X
Date: Mon, 29 Jun 2015 14:01:56 -0700
On Mon, Jun 29, 2015 at 11:39 AM, Paul Eggert <eggert <at> cs.ucla.edu> wrote:
> Jim Meyering wrote:
>>
>> the first variant compiled
>> just fine here (and probably everywhere),
>> so HAVE_GETGROUPLIST_WITH_INT was not defined.
>
>
> Yes, well, it did work on GNU/Linux, which is what I tested it on.....
>
> How about if we make the check pickier, so that it is likely to be triggered
> even without --enable-gcc-warnings, as in the attached?

Thanks for another patch! Unfortunately, that still evokes only a
warning at least
with gcc 6.0.0 20150426.




Information forwarded to bug-coreutils <at> gnu.org:
bug#20923; Package coreutils. (Mon, 29 Jun 2015 22:37:01 GMT) Full text and rfc822 format available.

Message #20 received at 20923 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: Gnulib bugs <bug-gnulib <at> gnu.org>, 20923 <20923 <at> debbugs.gnu.org>
Subject: Re: bug#20923: mgetgroups.c vs getgrouplist warning on OS X
Date: Mon, 29 Jun 2015 15:35:51 -0700
On Mon, Jun 29, 2015 at 2:01 PM, Jim Meyering <jim <at> meyering.net> wrote:
> On Mon, Jun 29, 2015 at 11:39 AM, Paul Eggert <eggert <at> cs.ucla.edu> wrote:
>> Jim Meyering wrote:
>>>
>>> the first variant compiled
>>> just fine here (and probably everywhere),
>>> so HAVE_GETGROUPLIST_WITH_INT was not defined.
>>
>>
>> Yes, well, it did work on GNU/Linux, which is what I tested it on.....
>>
>> How about if we make the check pickier, so that it is likely to be triggered
>> even without --enable-gcc-warnings, as in the attached?
>
> Thanks for another patch! Unfortunately, that still evokes only a
> warning at least
> with gcc 6.0.0 20150426.

Darn it. I see that I mistakenly pushed one of your patches
when I pushed the linkat.m4 fix, Paul. Sorry about that.
Happy to revert, if you'd like that. Let me know.




Information forwarded to bug-coreutils <at> gnu.org:
bug#20923; Package coreutils. (Tue, 30 Jun 2015 02:20:04 GMT) Full text and rfc822 format available.

Message #23 received at 20923 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Jim Meyering <jim <at> meyering.net>
Cc: Gnulib bugs <bug-gnulib <at> gnu.org>, 20923 <20923 <at> debbugs.gnu.org>
Subject: Re: bug#20923: mgetgroups.c vs getgrouplist warning on OS X
Date: Mon, 29 Jun 2015 19:19:05 -0700
[Message part 1 (text/plain, inline)]
Jim Meyering wrote:
> Darn it. I see that I mistakenly pushed one of your patches
> when I pushed the linkat.m4 fix, Paul. Sorry about that.
> Happy to revert, if you'd like that. Let me know.

No problem.  I installed the attached further patch; does it fix things for you? 
 If we can't get this to work I can revert the whole thing.
[0001-mgetgroups-fix-port-to-strict-OS-X.patch (text/x-diff, attachment)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#20923; Package coreutils. (Tue, 30 Jun 2015 03:04:02 GMT) Full text and rfc822 format available.

Message #26 received at 20923 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: Gnulib bugs <bug-gnulib <at> gnu.org>, 20923 <20923 <at> debbugs.gnu.org>
Subject: Re: bug#20923: mgetgroups.c vs getgrouplist warning on OS X
Date: Mon, 29 Jun 2015 20:03:23 -0700
[Message part 1 (text/plain, inline)]
On Mon, Jun 29, 2015 at 7:19 PM, Paul Eggert <eggert <at> cs.ucla.edu> wrote:
> Jim Meyering wrote:
>>
>> Darn it. I see that I mistakenly pushed one of your patches
>> when I pushed the linkat.m4 fix, Paul. Sorry about that.
>> Happy to revert, if you'd like that. Let me know.
>
> No problem.  I installed the attached further patch; does it fix things for
> you?  If we can't get this to work I can revert the whole thing.

Thanks.

I adjusted via the attached patch (the declaration
of getgrouplist is in <unistd.h>, and the "then"-block
should use gid_t), and tested: there was not even a
warning for the test program emitted by the "then"-block,
so same result as before:

  lib/mgetgroups.c: In function 'mgetgroups':
  lib/mgetgroups.c:70:32: error: pointer targets in passing argument 3
of 'getgrouplist' differ in signedness [-Werror=pointer-sign]
   #  define getgrouplist_gids(g) (g)
                                  ^
[mgetgroups.m4.patch (application/octet-stream, attachment)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#20923; Package coreutils. (Tue, 30 Jun 2015 16:37:01 GMT) Full text and rfc822 format available.

Message #29 received at 20923 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Jim Meyering <jim <at> meyering.net>
Cc: Gnulib bugs <bug-gnulib <at> gnu.org>, 20923 <20923 <at> debbugs.gnu.org>
Subject: Re: bug#20923: mgetgroups.c vs getgrouplist warning on OS X
Date: Tue, 30 Jun 2015 09:36:28 -0700
[Message part 1 (text/plain, inline)]
Jim Meyering wrote:

> same result as before:

OK, let's give up on this approach and try something more direct.  I installed 
the attached patch; does it work on OS X?


[0001-mgetgroups-port-to-strict-OS-X.patch (text/x-diff, attachment)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#20923; Package coreutils. (Tue, 30 Jun 2015 18:04:01 GMT) Full text and rfc822 format available.

Message #32 received at 20923 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: Gnulib bugs <bug-gnulib <at> gnu.org>, 20923 <20923 <at> debbugs.gnu.org>
Subject: Re: bug#20923: mgetgroups.c vs getgrouplist warning on OS X
Date: Tue, 30 Jun 2015 11:03:19 -0700
On Tue, Jun 30, 2015 at 9:36 AM, Paul Eggert <eggert <at> cs.ucla.edu> wrote:
> Jim Meyering wrote:
>
>> same result as before:
>
> OK, let's give up on this approach and try something more direct.  I
> installed the attached patch; does it work on OS X?

Perfect.
I made latest coreutils use latest from gnulib, and now it all compiles
warning-free there with --enable-gcc-warnings and gcc-6.x

Thank you!




Added tag(s) fixed. Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Tue, 23 Oct 2018 02:32:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 20923 <at> debbugs.gnu.org and Jim Meyering <jim <at> meyering.net> Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Tue, 23 Oct 2018 02:32:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 20 Nov 2018 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 152 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.