Current-Users archive

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

Re: hardlink to symlink behaviour [was: Re: MKXORG=yes on Linux: nbmtree: existing entry for `libXaw.so', type `link' does not match type `file']



Hubert Feyrer wrote:

On Tue, 30 Sep 2008, Hubert Feyrer wrote:
nbmtree: existing entry for `libXaw.so', type `link' does not match type `file'

Digging a bit more into this, it's related to the difference in handling hardlink to symlinks. On NetBSD, it seems that you get a link to the target file these days[1], while on Linux you get a link to the symlink[2]. ISTR that NetBSD used to behave like Linux there - is this really intended?

FWIW, Solaris behaves the same way as Linux does.


Yes, both of them are "incorrect" (if you can use this term for not following all other unix systems). :)

See this for a vulnerability because of this misbehavior:
http://securitytracker.com/alerts/2008/Aug/1020700.html


 - Hubert


[1] % set files="/tmp/f /tmp/lf /tmp/hlf" ; rm $files ; touch /tmp/f ; ln -s /tmp/f /tmp/lf ; ln /tmp/lf /tmp/hlf ; perl -e 'foreach $f (@ARGV) { @x=stat($f);printf "mode=%o for $f\n", $x[2]; }' $files ; ls -lad $files
    mode=100664 for /tmp/f
    mode=100664 for /tmp/lf
    mode=100664 for /tmp/hlf
    -rw-rw-r--  2 feyrer  wheel  0 Sep 30 13:59 /tmp/f
   ===>    -rw-rw-r--  2 feyrer  wheel  0 Sep 30 13:59 /tmp/hlf
    lrwxrwxr-x  1 feyrer  wheel  6 Sep 30 13:59 /tmp/lf -> /tmp/f


[2] % set files="/tmp/f /tmp/lf /tmp/hlf" ; rm $files ; touch /tmp/f ; ln -s /tmp/f /tmp/lf ; ln /tmp/lf /tmp/hlf ; perl -e 'foreach $f (@ARGV) { @x=stat($f);printf "mode=%o for $f\n", $x[2]; }' $files ; ls -lad $files
    mode=100664 for /tmp/f
    mode=100664 for /tmp/lf
    mode=100664 for /tmp/hlf
    -rw-rw-r-- 1 feyrer bedienst 0 Sep 30 13:59 /tmp/f
   ===>    lrwxrwxrwx 2 feyrer bedienst 6 Sep 30 13:59 /tmp/hlf -> /tmp/f
    lrwxrwxrwx 2 feyrer bedienst 6 Sep 30 13:59 /tmp/lf -> /tmp/f




Home | Main Index | Thread Index | Old Index