[Baypiggies] Unlinking symlinks

Andrew Akira Toulouse andrew at atoulou.se
Sat May 1 00:49:47 CEST 2010


A ha. You would be correct. OS X/HFS+ is apparently pretty lax about this.
This would seem to be an interesting cross-platform inconsistency.

The More You Know
%%%%%%%%%%%☆

--Andy

On Fri, Apr 30, 2010 at 3:28 PM, Brian Harring <ferringb at gmail.com> wrote:

> 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 --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/baypiggies/attachments/20100430/8e997bec/attachment.html>


More information about the Baypiggies mailing list