dylanaraps / pure-sh-bible

📖 A collection of pure POSIX sh alternatives to external processes.
MIT License
6.45k stars 281 forks source link

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

Open TinCanTech opened 3 years ago

TinCanTech commented 3 years ago

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.
spiralofhope commented 3 years ago

-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?

TinCanTech commented 3 years ago

I was using Linux Mint 20 Cinnamon, man dash

Looks like this is a contentious bone ..

spiralofhope commented 3 years ago

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

TinCanTech commented 3 years ago

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