#1138732 dash: in some cases command -v uses relative pathnames than absolutes as mandated by POSIX

Package:
dash
Source:
dash
Description:
POSIX-compliant shell
Submitter:
Christoph Anton Mitterer
Date:
2026-06-03 03:11:02 UTC
Severity:
normal
Tags:
#1138732#5
Date:
2026-06-03 02:22:54 UTC
From:
To:
Hey.

When using command -v command_name POSIX mandates[0] the following (amongst others):
"Executable utilities, regular built-in utilities, command_names including a <slash>
 character, and any implementation-provided functions that are found using the PATH
 variable (as described in 2.9.1.4 Command Search and Execution), shall be written
 as absolute pathnames."

Now I have a script "foo" in .bin/ :

dash:
$ PATH="./bin/:$PATH"
$ command -v pwg
./bin//pwg
$

bash:
$ PATH="./bin/:$PATH"
$ command -v pwg
./bin/pwg
$

bash --posix:
$ PATH="./bin/:$PATH"
$ command -v pwg
/home/calestyo/./bin/pwg
$

I think POSIX is clear that it should be an absolute pathname. :-)

Cheers,
Chris.


[0] https://pubs.opengroup.org/onlinepubs/9799919799/utilities/command.html