[Python-ideas] os.path.cansymlink(path)

Giampaolo Rodola' g.rodola at gmail.com
Fri Jul 25 11:54:07 CEST 2014


-1 for me as well given the reasons mentioned above.
Il 24/lug/2014 20:01 <dw+python-ideas at hmmz.org> ha scritto:

> On Thu, Jul 24, 2014 at 01:33:28PM -0400, Geoffrey Spear wrote:
>
> > > This code is wrong, because OS support for symlinks doesn't
> > > guarantee that mounted filesystem can do this, resulting in OSError
> > > at runtime. So, the proper check would be to check if specific path
> > > supports symlinking.
> > >
> > > The idea is:
> > >
> > >     os.path.cansymlink(path)  - Return True if filesystem
> > >         of specified path can be symlinked.
> > >
> > > Yes/No/Opinions?
>
> -1, since there is no sane way to guarantee a FS operation will succeed
> without trying it in most cases. Even if a filesystem (driver) supports
> the operation, the filesystem (data) might be exhausted, e.g. inode
> count, max directory entries, ... And if not that, then e.g. in the case
> of NFS or CIFS, while the protocol might support the operation, there is
> no mechanism for a particular server implementation to communicate that
> it does not support it.
>
> Even if none of this were true, it also introduces a race between a
> program testing the state of the filesystem, and that state changing,
> e.g. due to USB disconnect, or a lazy unmount succeeding, or..
>
>
> David
>
> >
> > Surely the third-party module you found that wrong code in has their
> > own communication channels?
> > _______________________________________________
> > Python-ideas mailing list
> > Python-ideas at python.org
> > https://mail.python.org/mailman/listinfo/python-ideas
> > Code of Conduct: http://python.org/psf/codeofconduct/
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140725/e16314ef/attachment.html>


More information about the Python-ideas mailing list