[Baypiggies] Unlinking symlinks

Brian Harring ferringb at gmail.com
Sat May 1 00:28:58 CEST 2010


On Fri, Apr 30, 2010 at 03:07:12PM -0700, Andrew Akira Toulouse wrote:
>    I did one additional test on top of this - if you take the same
>    directions, but
>    replace os.unlink("blahlink") with os.unlink("blahlink/"), it will
>    dereference the symlink and unlink 'blah' -- trailing slashes do in
>    fact dereference symlinks, even if they are files.

Either your test, FS, or OS is screwed up then.  '/' doesn't mean 
'derefence it'- not in any interpretation of posix rules I've ever 
seen.


>    Further, if you put
>    some text in 'blah' and type 'cat blahlink/' it acts identically to
>    'cat blah'.

run

(
unalias rm ln cat &> /dev/null
echo "monkeys" > rule
ln -s rule fails
cat fails
cat rule
cat fails/
rm fails/  # boom,
python -c 'import os;os.unlink("fails/")' # boom..
rm fails
)

Etc.

~harring
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/baypiggies/attachments/20100430/b1ab6bfe/attachment.pgp>


More information about the Baypiggies mailing list