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 734947 - cups backend should define _XOPEN_SOURCE or _GNU_SOURCE on any glibc, not just Linux
cups backend should define _XOPEN_SOURCE or _GNU_SOURCE on any glibc, not jus...
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Printing
3.12.x
Other other
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2014-08-17 13:52 UTC by Simon McVittie
Modified: 2014-08-25 10:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Use AC_USE_SYSTEM_EXTENSIONS to get _GNU_SOURCE, _XOPEN_SOURCE etc. (3.12 KB, patch)
2014-08-17 14:12 UTC, Simon McVittie
committed Details | Review

Description Simon McVittie 2014-08-17 13:52:48 UTC
gtkprintbackendcups.c uses

#ifdef __linux__
#define _GNU_SOURCE
#endif

and then uses strptime(). On systems that use glibc but are not Linux (e.g. Debian GNU/kFreeBSD and GNU/Hurd) this results in:

/build/gtk+3.0-KGFa7z/gtk+3.0-3.12.2/./modules/printbackends/cups/gtkprintbackendcups.c: In function 'localtime_to_utctime':
/build/gtk+3.0-KGFa7z/gtk+3.0-3.12.2/./modules/printbackends/cups/gtkprintbackendcups.c:5569:9: warning: implicit declaration of function 'strptime' [-Wimplicit-function-declaration]
         end = strptime (local_time, formats_0[i], &local_print_time);
         ^
/build/gtk+3.0-KGFa7z/gtk+3.0-3.12.2/./modules/printbackends/cups/gtkprintbackendcups.c:5569:13: warning: assignment makes pointer from integer without a cast
         end = strptime (local_time, formats_0[i], &local_print_time);
             ^
/build/gtk+3.0-KGFa7z/gtk+3.0-3.12.2/./modules/printbackends/cups/gtkprintbackendcups.c:5571:13: warning: assignment makes pointer from integer without a cast
         end = strptime (local_time, formats_1[i], &local_print_time);
             ^

and possibly truncating pointers to 32 bits, causing runtime failure.

I think it would be better to use AC_USE_SYSTEM_EXTENSIONS in configure.ac, like GLib does since Bug #684123 was fixed.
Comment 1 Simon McVittie 2014-08-17 14:12:39 UTC
Created attachment 283652 [details] [review]
Use AC_USE_SYSTEM_EXTENSIONS to get _GNU_SOURCE, _XOPEN_SOURCE etc.

Similar to Bug #684123 in GLib.
Comment 2 Matthias Clasen 2014-08-17 15:04:14 UTC
Review of attachment 283652 [details] [review]:

Ok
Comment 3 Simon McVittie 2014-08-25 10:47:07 UTC
Comment on attachment 283652 [details] [review]
Use AC_USE_SYSTEM_EXTENSIONS to get _GNU_SOURCE, _XOPEN_SOURCE etc.

Commit d329544 for 3.13.8. I merged it but forgot to say so here - thanks for closing the bug, Matthias.