execvpe limits PATH environment variable to PATH_MAX

Nils Andre nils@nilsand.re
Mon Mar 30 16:57:14 GMT 2020


Hello,

Commit 1eb8930608705702d5746e5491bab4e4429fcb83, limits the length of
the `PATH` environment variable to `PATH_MAX`. The commit message just
mentions it without explaining why that is the case.

Considering that using `nix-shell`[1], to load a [ccextractor][2] development
environment, my `PATH` ends up being 2033 bytes long, I find the limit
to `PATH_MAX` quite tight and arbitrary.

Regardless of the whether the limit is narrow or not, I find that
setting a hard limit for `PATH` to be unintuitive as there is no reason
to assume that `PATH` will fall under a certain limit. Even more so,
when using `PATH_MAX` (as the limit) because it is unrelated.

Would it be possible to know the reason for this limit?

Thank you,

Nils ANDRÉ-CHANG

[1]: https://nixos.org/nix/manual/#sec-nix-shell
[2]: https://github.com/CCExtractor/ccextractor


More information about the Libc-alpha mailing list