command -v ../foo when ../foo is a directory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi.

I noticed a (to me) unexpected difference between bash and dash, compare
bash behaviour:

jas@latte:~$ mkdir -p foo foo/bar
jas@latte:~$ cd foo/bar
jas@latte:~/foo/bar$ command -v ../bar
jas@latte:~/foo/bar$ echo $?
1
jas@latte:~/foo/bar$ 

with dash behaviour:

$ mkdir -p foo foo/bar
$ cd foo/bar
$ command -v ../bar
../bar
$ echo $?
0
$ 

That is, dash's 'command -v' return success on directories for relative
names.  I believe the dash behaviour is incorrect, but I'd appreciate if
someone else read the POSIX spec here.  Do you agree?

This is on Debian bullseye with dash 0.5.11+git20200708+dd9ef66-5 and
bash 5.1-2+deb11u1.

/Simon

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux