[PATCH] posix: execvpe: skip $PATH components that are too long
Pádraig Brady
P@draigBrady.com
Thu Nov 13 18:31:59 GMT 2025
Adhemerval Zanella Netto wrote:
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.
Cool. I've created https://sourceware.org/PR33626
and attached an updated patch to include a test case
(also attached here).
cheers,
Padraig
-------------- next part --------------
A non-text attachment was scrubbed...
Name: glibc-execvpe-enametoolong.patch
Type: text/x-patch
Size: 3777 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20251113/525f49dd/attachment-0001.bin>
More information about the Libc-alpha
mailing list