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

Christoph Anton Mitterer <[email protected]> Wed, 03 Jun 2026 05:02:01 +0200
Newsgroups org.kernel.vger.dash
Message-ID <[email protected]>
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>
=C2=A0character, and any implementation-provided functions that are found u=
sing the PATH
=C2=A0variable (as described in 2.9.1.4 Command Search and Execution), shal=
l be written
=C2=A0as absolute pathnames."

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

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

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

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

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

Cheers,
Chris.

PS: This is forwarded from [1], where I submitted it, so that it
doesn't get forgotten :-)

[0] https://pubs.opengroup.org/onlinepubs/9799919799/utilities/command.html
[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=3D1138732