NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: bin/61083: fexecve fails on sh-based /usr/bin/true
The following reply was made to PR bin/61083; it has been noted by GNATS.
From: RVP <rvp%SDF.ORG@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc:
Subject: Re: bin/61083: fexecve fails on sh-based /usr/bin/true
Date: Fri, 27 Nov 2026 09:40:36 +0000 (UTC)
On Thu, 26 Nov 2026, contact+netbsd.org%hacktivis.me@localhost via gnats wrote:
>> Description:
> When a file-descriptor for sh-based "/usr/bin/true" is passed to fexecve(), /bin/sh then fails with "/bin/sh: Can't open true".
> Strangely if "/usr/bin/true" is copied into the home, it then works without any issues.
>
> [...]
>
> $ ls -l
> total 64
> -r-xr-xr-x 1 build users 18 Nov 26 22:38 exit0.sh
> -rwxr-xr-x 1 build users 23352 Nov 26 22:31 fexec
> -rw-r--r-- 1 build users 513 Nov 26 22:31 fexec.c
> -rwxr-xr-x 1 build users 37 Nov 26 22:40 hello.sh
> $ ls -l /usr/bin/true
> -r-xr-xr-x 1 root wheel 18 Jul 30 15:23 /usr/bin/true
> $
>
This is a kernel issue. In the fexecve()+script case, the kernel strips off the
directory components, so the script has to always be in the current directory:
https://github.com/NetBSD/src/blob/trunk/sys/kern/kern_exec.c#L340
`/usr/bin/true' should also run if you `cd /usr/bin' first.
-RVP
Home |
Main Index |
Thread Index |
Old Index