This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author grobian
Recipients grobian, hynek
Date 2012-04-26.17:42:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1335462140.55.0.00046856192817.issue14662@psf.upfronthosting.co.za>
In-reply-to
Content
% echo "test" > /var/tmp/testfile
% python
Python 2.7.3 (default, Apr 26 2012, 19:06:37) 
[GCC 4.2.1 (Gentoo 4.2.1_p5666, Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import shutil
>>> shutil.move("/var/tmp/testfile", "./testfile");
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Gentoo/usr/lib/python2.7/shutil.py", line 299, in move
    copy2(src, real_dst)
  File "/Library/Gentoo/usr/lib/python2.7/shutil.py", line 129, in copy2
    copystat(src, dst)
  File "/Library/Gentoo/usr/lib/python2.7/shutil.py", line 103, in copystat
    os.chflags(dst, st.st_flags)
OSError: [Errno 45] Operation not supported: './testfile'
>>> 
% vi /Library/Gentoo/usr/lib/python2.7/shutil.py
% python
Python 2.7.3 (default, Apr 26 2012, 19:06:37) 
[GCC 4.2.1 (Gentoo 4.2.1_p5666, Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import shutil
>>> shutil.move("/var/tmp/testfile", "./testfile");
45
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Gentoo/usr/lib/python2.7/shutil.py", line 300, in move
    copy2(src, real_dst)
  File "/Library/Gentoo/usr/lib/python2.7/shutil.py", line 130, in copy2
    copystat(src, dst)
  File "/Library/Gentoo/usr/lib/python2.7/shutil.py", line 103, in copystat
    os.chflags(dst, st.st_flags)
OSError: [Errno 45] Operation not supported: './testfile'
>>> 
% grep 45 /usr/include/sys/errno.h
#define ENOTSUP         45              /* Operation not supported */

I tried with a FAT16 formatted USB-disk, but there it doesn't fail, so I did some further digging.  MS-DOS FS (under OSX) just seems to support setting flags (I tried with stat.UF_HIDDEN, Finder no longer displays the file).

NFS, however, does NOT support any chflags call.

% python
Python 2.7.3 (default, Apr 26 2012, 19:06:37) 
[GCC 4.2.1 (Gentoo 4.2.1_p5666, Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import errno
>>> print hasattr(errno, 'EOPNOTSUPP')
True
>>> print errno.EOPNOTSUPP
102
>>> 

102 obviously != 45

% grep 102 /usr/include/sys/errno.h
#define EOPNOTSUPP      102             /* Operation not supported on socket */

I believe Python got it mixed up here, we're looking for ENOTSUP, but that one doesn't exist, at least not here.

>>> print hasattr(errno, 'ENOTSUP')
False
History
Date User Action Args
2012-04-26 17:42:20grobiansetrecipients: + grobian, hynek
2012-04-26 17:42:20grobiansetmessageid: <1335462140.55.0.00046856192817.issue14662@psf.upfronthosting.co.za>
2012-04-26 17:42:19grobianlinkissue14662 messages
2012-04-26 17:42:19grobiancreate