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 733393 - Fails to run on GNU/Hurd
Fails to run on GNU/Hurd
Status: RESOLVED FIXED
Product: seed
Classification: Bindings
Component: libseed
3.8.x
Other GNU Hurd
: Normal normal
: ---
Assigned To: seed-maint
seed-maint
Depends on:
Blocks:
 
 
Reported: 2014-07-19 10:48 UTC by Pino Toscano
Modified: 2014-08-04 08:23 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
use realpath(path, NULL) (1.87 KB, patch)
2014-07-19 10:48 UTC, Pino Toscano
none Details | Review

Description Pino Toscano 2014-07-19 10:48:34 UTC
Created attachment 281172 [details] [review]
use realpath(path, NULL)

seed fails to run on GNU/Hurd, as a consequence of the changes of bugs #650233 and
#650234 (committed as 18861a32f2a251c323c21e172ad39fd91fc80e3f and 03c808137331be912e9adde997dd2830cf2e5593).

Basically, what happens is that the result of pathconf is long (see [1]), while it gets assigned to a gsize variable, which is unsigned; since on GNU/Hurd PATH_MAX is not defined (on purpose) and pathconf(_PC_PATH_MAX) returns -1, the result assigned to the path_max variables becomes UINT_MAX, which of course makes malloc fail.

The real problem behind those *BSD changes is that they changed the correct approach, i.e. using realpath(path, NULL) (which allocates a new buffer with the result), into something supposed to support the lack of that situation (see also the NOTES in [2]). On the other hand, realpath(path, NULL) is part of POSIX.1-2008 [3], and it seems also FreeBSD's libc supports it [4].

Thus, the fix I'm proposing is basically to revert those realpath changes, making again use of realpath(path, NULL), which should work on modern POSIX-compliant systems.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/pathconf.html
[2] http://man7.org/linux/man-pages/man3/realpath.3.html
[3] http://pubs.opengroup.org/onlinepubs/9699919799/functions/realpath.html
[4] http://www.freebsd.org/cgi/man.cgi?query=realpath&sektion=3
Comment 1 Alan Knowles 2014-08-04 08:23:26 UTC
thanks - yes this looks like the right approach

committed

Regards
Alan