Page MenuHomePhabricator

Add missing PATH_MAX for GNU Hurd support
Needs ReviewPublic

Authored by sylvestre.ledru on Oct 18 2018, 1:28 PM.

Details

Reviewers
rnk
Summary

If you have a better place to put them, don't hesitate to let me know :)

Patch by Svante Signell & myself

Diff Detail

Event Timeline

rsmith added a subscriber: rsmith.Oct 18 2018, 1:57 PM
rsmith added inline comments.
lib/Basic/FileManager.cpp
514–519

This doesn't appear to be necessary: the identifier PATH_MAX does not appear later in this file.

lib/Frontend/ModuleDependencyCollector.cpp
102–106

I think this is generally the wrong way to address this problem on Hurd:

https://www.gnu.org/software/hurd/hurd/porting/guidelines.html#PATH_MAX_tt_MAX_PATH_tt_MAXPATHL

If PATH_MAX isn't defined, we should instead pass NULL to realpath (and deallocate the result): passing a fixed-size buffer is wrong, because we cannot assume that the real path will fit in 4096 bytes.

(If we neither have PATH_MAX defined nor a realpath that can accept a null pointer as the destination buffer, then realpath is unusable on that platform and there's nothing we can do there but return a false result to the caller of real_path.)