Re: [PATCH v2] exec: Print absolute paths for command location queries

Harald van Dijk <[email protected]> Sat, 13 Jun 2026 03:09:49 +0100
Newsgroups org.kernel.vger.dash
Message-ID <[email protected]>
On 6/13/26 02:56, Herbert Xu wrote:
> On Sat, Jun 13, 2026 at 02:52:29AM +0100, Harald van Dijk wrote:
>>
>> You're overlooking the "that are found using the PATH variable" from the
>> spec. Because you included a / in the command, it is not looked up from
>> PATH. Modifying your test to make sure PATH is used, we can see that bash
>> does do this in POSIX mode:
>>
>> $ bash -c 'cd /; PATH=bin command -v bash'
>> bin/bash
>> $ bash -o posix -c 'cd /; PATH=bin command -v bash'
>> /bin/bash
> 
> But that's not what this patch does, is it?

Oh, I see. Currently, dash never converts paths to absolute. The patch 
changes it to do so whenever possible, both for the case where commands 
are looked up from PATH (which is required by POSIX) and the case where 
they aren't (where I think POSIX is ambiguous). Other shells (ksh, yash) 
do print an absolute path in all cases, but matching bash sounds 
reasonable too.

Cheers,
Harald van Dijk