After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 756475 - ac_cv_func_posix_getpwuid_r/ac_cv_func_posix_getgrgid_r breaks cross-compile
ac_cv_func_posix_getpwuid_r/ac_cv_func_posix_getgrgid_r breaks cross-compile
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: build
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2015-10-13 02:17 UTC by Mike Frysinger
Modified: 2015-12-16 14:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Stop supporting non-POSIX getpwuid_r, getgrgid_r (7.06 KB, patch)
2015-10-16 11:39 UTC, Allison Karlitskaya (desrt)
committed Details | Review

Description Mike Frysinger 2015-10-13 02:17:43 UTC
the glib configure.ac has:
 	AC_CACHE_CHECK([for posix getpwuid_r],
		ac_cv_func_posix_getpwuid_r,
		[AC_TRY_RUN([
#include <errno.h>
#include <pwd.h>
int main () { 
    char buffer[10000];
    struct passwd pwd, *pwptr = &pwd;
    int error;
    errno = 0;
    error = getpwuid_r (0, &pwd, buffer, 
                        sizeof (buffer), &pwptr);
   return (error < 0 && errno == ENOSYS) 
	   || error == ENOSYS; 
}                               ],
			[ac_cv_func_posix_getpwuid_r=yes],
			[ac_cv_func_posix_getpwuid_r=no])])

in the cross-compile case, this fails.  it should just fallback to a link time test and call it a day.
Comment 1 Colin Walters 2015-10-13 02:21:38 UTC
I think most projects that focus on cross builds like OpenEmbedded have been maintaining cache variables there.

(It's overall not a very robust system either way, but in reality the cross frameworks are more likely to learn first about exotic architectures than each upstream project is to)
Comment 2 Mike Frysinger 2015-10-13 02:24:16 UTC
(In reply to Mike Frysinger from comment #0)

let's lump the ac_cv_func_posix_getgrgid_r test in here too since it's right after and does the same exact thing

(In reply to Colin Walters from comment #1)

i'm aware of OE works (and i've designed the same exact systems multiple times).  but it's just a hack that devs do because they can't be bothered to report the issue to the respective upstream to get it fixed properly in the first place.
Comment 3 Colin Walters 2015-10-13 14:14:50 UTC
(In reply to Mike Frysinger from comment #2)
> (In reply to Mike Frysinger from comment #0)
> 
> let's lump the ac_cv_func_posix_getgrgid_r test in here too since it's right
> after and does the same exact thing
> 
> (In reply to Colin Walters from comment #1)
> 
> i'm aware of OE works (and i've designed the same exact systems multiple
> times).  but it's just a hack that devs do because they can't be bothered to
> report the issue to the respective upstream to get it fixed properly in the
> first place.

I'm aware of your experience with build systems too =)  I don't think it's quite as clear cut as that.  Your bug reports look correct, but a tricky thing for doing this upstream is often we don't have the setup to *test* the patch.  You'd get a lot more mileage out of submitting (downstream tested) patches rather than bugs for this.
Comment 4 Mike Frysinger 2015-10-15 17:41:45 UTC
(In reply to Colin Walters from comment #3)

submitting to bugzilla or some mailing list ?  i've submitted patches and one-line diffs to other bugs to the GNOME bugzilla and haven't seen any responses, so i'm a bit pessimistic :/.
Comment 5 Allison Karlitskaya (desrt) 2015-10-16 11:17:29 UTC
The check is broken even without considering cross-compile cases: we should never check ENOSYS at ./configure time because the build machine very likely has a different kernel version than the one (or ones) that the resulting binary will actually be run on...

I'd be happy to see this simplified in any case.
Comment 6 Allison Karlitskaya (desrt) 2015-10-16 11:39:47 UTC
Created attachment 313455 [details] [review]
Stop supporting non-POSIX getpwuid_r, getgrgid_r

Bug 13403 introduced support for the non-POSIX variants of these APIs
found on a system called "DG/UX".  Meanwhile, the complicated checks
here are breaking cross-builds on systems that we actually care about.

Remove the complicated checks and replace them with AC_CHECK_FUNCS.
Remove the resulting dead code from a couple of .c files.
Comment 7 Colin Walters 2015-10-16 13:21:23 UTC
Review of attachment 313455 [details] [review]:

Looks fine to me.
Comment 8 Matthias Clasen 2015-12-16 14:09:49 UTC
Attachment 313455 [details] pushed as aa16359 - Stop supporting non-POSIX getpwuid_r, getgrgid_r