GNOME Bugzilla – Bug 733393
Fails to run on GNU/Hurd
Last modified: 2014-08-04 08:23:26 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
thanks - yes this looks like the right approach committed Regards Alan