there is a failure when building xprint on GNU/Hurd on Debian unstable: gcc -c -O2 -fno-strength-reduce -fno-strict-aliasing -ansi -pedantic -Wall -Wpointer-arith -Wstrict-prot otypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-dec ls -Wnested-externs -Wundef -I../.. -I../../exports/include -D__i386__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D _SVID_SOURCE -DFUNCPROTO=15 -DNARROWPROTO -DXTHREADS -D_REENTRANT -DXUSE_MTSAFE_API -DMALLOC_0_RETUR NS_NULL -fPIC XpJob.c XpJob.c: In function `XpStartJob': XpJob.c:108: error: too few arguments to function `getpwuid_r' make[5]: *** [XpJob.o] Error 1 The attached patch by Robert Millan has been integrated into both the Debian xfree86 package and Ubuntu's xorg package, and should fix this. He generated the patch for GNU/k*BSD, so I guess that system would fail to build xprint currently as well. Not sure whether this patch would propagate to xorg from this bug report automatically, or whether I should file a seperate bug there. cheers, Michael
Created attachment 1941 [details] [review] proposed patch by Robert Millan
Created attachment 1942 [details] [review] proposed patch by Robert Millan (correct file this time)
Created attachment 1944 [details] [review] Patch with unnecessary hunks removed Some parts of the original patch reference parts of the xorg source which is no in xprint, so these were deleted
(In reply to comment #3) > Created an attachment (id=1944) [edit] > Patch with unnecessary hunks removed > > Some parts of the original patch reference parts of the xorg source which is no > in xprint, so these were deleted This kind of stripping isn't needed as the Xprint and X.org founation CVS trees have been merged in X11R6.8.0 (actually Xprint was added in the X.org consortium release X11R6.3 but various vendors kept their drivers in their own source trees without sending them back to X.org (that changed with X11R6.8.0)).
Comment on attachment 1944 [details] [review] Patch with unnecessary hunks removed Moving back to previous patch...
Comment on attachment 1942 [details] [review] proposed patch by Robert Millan (correct file this time) Alan: Can you check whether the patch is OK for you, please ?
Comment on attachment 1942 [details] [review] proposed patch by Robert Millan (correct file this time) This patch is broken: 1) "dumy" typo in Xt/Initialize.c 2) It changes the call from the 4-arg version to the 5-arg version on platforms which only use 4-args. For instance, after applying, Solaris builds fail with: "Initialize.c", line 307: prototype mismatch: 5 args passed, 4 expected "Initialize.c", line 356: undefined symbol: dumy "Initialize.c", line 356: prototype mismatch: 5 args passed, 4 expected "Initialize.c", line 358: prototype mismatch: 5 args passed, 4 expected It doesn't correct the other bug in the calls to the 5-arg version, which is that they return an errno value on failure, not -1, so failure is incorrectly detected. The correct fix would be to adjust the defines for platforms that use the 5-arg variant to use the support in Xos_r.h that already exists for it, without having to change any callers - it should fall through to the _POSIX_THREAD_SAFE_FUNCTIONS set of code at line 367 of Xos_r.h that handles the 5-arg variant and includes the needed pointer in the _Xgetpwparams so the callers don't have to be modified to define a dummy pointer themselves.
Created attachment 2007 [details] [review] Patch to Xos_r.h to detect error properly and use correct version on Solaris This patch (which I'm committing to head now) fixes the afore-mentioned bug in checking the return values from the POSIX-conformant version, and fixes the Solaris #ifdefs. It doesn't solve the main problem of this bug, the #ifdefs choosing the wrong version for these platforms, but I don't know what the correct #defines to check for those platforms is, so leave that to someone who does.
Michael/Robert: Can you make a new patch for GNU/Hurd to match Alan's review comments, please ?
We will try to come up with a patch. However, I had looked at Xos_r.h for quite a while before I found Robert's patch and could not really figure out how/where platforms are supposed to define their version of getpwuid_r. Also note that GNU/Linux and GNU/Hurd (as are GNU/k*BSD) both are variants of the GNU system and thus are both based on glibc. So it would perhaps be better to just define this properly for glibc and make Linux and Hurd define glibc.
If glibc is providing the POSIX thread interfaces, it should #define _POSIX_THREAD_SAFE_FUNCTIONS, in which case Xos_r.h should choose the correct 5-arg variant. To get those variants used when that's not defined, add the appropriate check for your platform to this section of the checks: #elif !defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(__APPLE__) so for instance if the 5-arg versions were to be used any time GNU_HURD_HERE was defined, you'ld change it to: #elif !defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(__APPLE__) && !defined(GNU_HURD_HERE) and it would fall into the #else case about 30 lines lower that uses the POSIX 5-arg calls.
*** Bug 3372 has been marked as a duplicate of this bug. ***
Changing from xprint to xorg so people find it.
Similar problem on NetBSD/i386 3.0_BETA also with libX11 and libXt. Initialize.c:357: error: too few arguments to function `getpwnam_r' Initialize.c:359: error: too few arguments to function `getpwuid_r' My workaround: -DXNO_MTSAFE_PWDAPI -D_REENTRANT
So what define does this code need to check for on NetBSD to find out which version of the functions to use? Is it simply that all versions of NetBSD use the 5-arg variants or was it changed at some point or controlled by some other #ifdef?
Sorry I do not know what define is needed. Looking closer, I see these reentrant functions were added to NetBSD in Oct. 2004 and they will be in the NetBSD 3 to be released real soon (maybe before X.org is released). This NetBSD pwd.h has: #if (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \ defined(_REENTRANT) || defined(_NETBSD_SOURCE) int getpwnam_r(const char *, struct passwd *, char *, size_t, struct passwd **); int getpwuid_r(uid_t, struct passwd *, char *, size_t, struct passwd **); #endif
Created attachment 5032 [details] [review] patch for NetBSD.cf Hi, 6.9.0 works on NetBSD 3.0 for me with this. <threadlib.h> was removed December 2004 according to the CVS log, about the same time the reentrant functions were added according to the above message, so I simply used that check. It may not be perfect, but hopefully it's good enough. I don't know enough to give you a better check, sorry.
Created attachment 5033 [details] [review] Similar patch for libX11 And for libX11's configure script, a similar patch works.
(In reply to comment #11) > If glibc is providing the POSIX thread interfaces, it should > #define _POSIX_THREAD_SAFE_FUNCTIONS, in which case Xos_r.h > should choose the correct 5-arg variant. Indeed, it turned out that <bits/posix_opt.h> got updated recently (now #defining _POSIX_THREAD_SAFE_FUNCTIONS) for GNU/Hurd (it is in glibc-2.4), my glibc-2.3.6 based system does not have this yet. As far as libX11 is concerned, it builds fine on GNU/Hurd with the updated system header now, so this is NOTABUG as far as we are concerned (maybe retitle to NetBSD). thanks, Michael
Sorry about the phenomenal bug spam, guys. Adding xorg-team@ to the QA contact so bugs don't get lost in future.
*** Bug 3293 has been marked as a duplicate of this bug. ***
looks like this was fixed a while ago commit 129bbb9f9114a571556fa3a24f15ba58a5cdb2de Author: Jeremy C. Reed <reed@glacier.reedmedia.net> Date: Thu Dec 14 14:21:19 2006 -0600 For NetBSD, define the XTHREADLIB and XTHREAD_CFLAGS.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.