[PATCH] posix: execvpe: skip $PATH components that are too long
Adhemerval Zanella Netto
adhemerval.zanella@linaro.org
Mon Nov 10 12:20:12 GMT 2025
On 08/11/25 16:51, Pádraig Brady wrote:
> * posix/execvpe.c (__execvpe_common): Rather than error out
> with ENAMETOOLONG, just ignore and try the next path.
> Note we know the FILE length is <= NAME_MAX, so the ENAMETOOLONG
> almost certainly pertains to the current $PATH entry.
> ---
> posix/execvpe.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/posix/execvpe.c b/posix/execvpe.c
> index c139dfe8fd..0fb09b9631 100644
> --- a/posix/execvpe.c
> +++ b/posix/execvpe.c
> @@ -156,6 +156,9 @@ __execvpe_common (const char *file, char *const argv[], char *const envp[],
> /* Those errors indicate the file is missing or not executable
> by us, in which case we want to just try the next path
> directory. */
> + case ENAMETOOLONG:
> + /* We've already verified that the FILE length is < NAME_MAX,
> + so this implies a path component is too long, so skip it. */
> case ENODEV:
> case ETIMEDOUT:
> /* Some strange filesystems like AFS return even
I think if Paul's latest comment holds that this is indeed an issue, we should
add a bug report and a regression test for this issue.
More information about the Libc-alpha
mailing list