bug#7450: cp does not check for errno=EISDIR when target is dangling lin
From:
Марк Коренберг
Subject:
bug#7450: cp does not check for errno=EISDIR when target is dangling link
Date:
Sat, 20 Nov 2010 18:39:58 +0500
How to reproduce:
$ ln -s non-exist tgt
$ cp /etc/passwd tgt
cp: not writing through dangling symlink `tgt'
As we see, cp know, that if retval EEXIST and target is symlink,
special responce given.
Now, try to add slash at the end of target:
$ cp /etc/passwd tgt/
cp: cannot create regular file `tgt/': Is a directory
Novices can not understand this message :)
cp should check if (target is symlink and error is EISDIR) and report
message like this:
cp: Trying to use dangling symlink `tgt' as a directory
--
Segmentation fault