Bug 98632 - Fix build on Hurd without PATH_MAX
Summary: Fix build on Hurd without PATH_MAX
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: 13.0
Hardware: Other other
: medium normal
Assignee: mesa-dev
QA Contact: mesa-dev
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-11-07 21:21 UTC by Samuel Thibault
Modified: 2016-11-19 03:20 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
proposed fix (3.84 KB, patch)
2016-11-07 21:21 UTC, Samuel Thibault
Details | Splinter Review

Description Samuel Thibault 2016-11-07 21:21:38 UTC
Created attachment 127822 [details] [review]
proposed fix

Hello,

Version 13.0 of mesa doesn't build on GNU/Hurd any more because of new occurrences of PATH_MAX, which hurd-i386 doesn't define since it doesn't have such
arbitrary limitation.

Here is a patch to fix this.

Samuel
Comment 1 Kenneth Graunke 2016-11-09 19:47:46 UTC
Please send this to mesa-dev.
Comment 2 Emil Velikov 2016-11-09 20:27:25 UTC
As Ken mentioned please follow the instructions [1]. Also consider the most obvious suggestion/counter-proposal - can we have a local define with reasonable default for the platform ;-)

Thanks
[1] http://mesa3d.org/devinfo.html#submitting
Comment 3 Kenneth Graunke 2016-11-19 03:20:00 UTC
I liked Samuel's approach of allocating the name to be the correct length, but opted to use asprintf rather than trying to manually compute that length.

Fixed by:

commit 9bfee7047b70cb0aa026ca9536465762f96cb2b1
Author: Kenneth Graunke <kenneth@whitecape.org>
Date:   Tue Nov 15 11:53:33 2016 -0800

    mesa: Drop PATH_MAX usage.
    
    GNU/Hurd does not define PATH_MAX since it doesn't have such arbitrary
    limitation, so this failed to compile.  Apparently glibc does not
    enforce PATH_MAX restrictions anyway, so it's kind of a hoax:
    
    https://www.gnu.org/software/libc/manual/html_node/Limits-for-Files.html
    
    MSVC uses a different name (_MAX_PATH) as well, which is annoying.
    
    We don't really need it.  We can simply asprintf() the filenames.
    If the filename exceeds an OS path limit, presumably fopen() will
    fail, and we already check that.  (We actually use ralloc_asprintf
    because Mesa provides that everywhere, and it doesn't look like we've
    provided an implementation of GNU's asprintf() for all platforms.)
    
    Fixes the build on GNU/Hurd.
    
    Cc: "13.0" <mesa-stable@lists.freedesktop.org>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98632
    Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
    Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
    Reviewed-by: Emil Velikov <emil.velikov@collabora.com>


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.