pure-sh-bible icon indicating copy to clipboard operation
pure-sh-bible copied to clipboard

dash "-L" test for symbolic link may not be reliable

Open TinCanTech opened this issue 4 years ago • 4 comments

Using dash I came across this and thought it may effect you.

-L file     True if file exists and is a symbolic link.  This operator is 
            retained for compatibility with previous versions of this
            program.  Do not rely on its existence; use -h instead.

TinCanTech avatar Nov 20 '20 20:11 TinCanTech

-L and -h are both valid here: https://linux.die.net/man/1/test

I can find your text in BSD, but it's the opposite! https://www.freebsd.org/cgi/man.cgi?test

-h	file
     True if file exists and is a symbolic link. This operator
     is retained for compatibility with previous versions of
     this program.  Do not rely on its existence; use -L in-
     stead.

Where can I find your reference in dash itself?

spiralofhope avatar Nov 30 '20 04:11 spiralofhope

I was using Linux Mint 20 Cinnamon, man dash

Looks like this is a contentious bone ..

TinCanTech avatar Nov 30 '20 15:11 TinCanTech

I checked with Debian (Devuan) man dash and it agrees with your Mint 20, saying to use -h.

spiralofhope avatar Dec 02 '20 10:12 spiralofhope

I find myself disinclined to agree with both Mint and Duvian.

TinCanTech avatar Dec 03 '20 02:12 TinCanTech