classification
Title: shutil tests, test_copy2_xattr and test_copyxattr, fail
Type: Stage: resolved
Components: Library (Lib) Versions: Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: hynek Nosy List: eric.araujo, hynek, python-dev, tarek, tshepang
Priority: normal Keywords: patch

Created on 2012-05-22 20:01 by tshepang, last changed 2012-05-23 16:17 by hynek. This issue is now closed.

Files
File name Uploaded Description Edit
test-tmp-for-xattr.diff hynek, 2012-05-22 21:04 review
Messages (9)
msg161376 - (view) Author: Tshepang Lekhonkhobe (tshepang) * Date: 2012-05-22 20:01
$ ./python -m test -v test_shutil
...[snip]...
======================================================================
ERROR: test_copy2_xattr (test.test_shutil.TestShutil)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/wena/src/python/cpython/Lib/test/test_shutil.py", line 439, in test_copy2_xattr
    os.setxattr(src, 'user.foo', b'42')
OSError: [Errno 95] Operation not supported

======================================================================
ERROR: test_copyxattr (test.test_shutil.TestShutil)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/wena/src/python/cpython/Lib/test/test_shutil.py", line 325, in test_copyxattr
    os.setxattr(src, 'user.foo', b'42')
OSError: [Errno 95] Operation not supported

...[snip]...
msg161377 - (view) Author: Hynek Schlawack (hynek) * (Python committer) Date: 2012-05-22 20:18
Could you give me your precise platform information please? Including full kernel version and "mount" output? Also, could you check whether test_os fails too?

Thanks!
msg161378 - (view) Author: Tshepang Lekhonkhobe (tshepang) * Date: 2012-05-22 20:25
$ uname -a
Linux tshepang 3.2.0-2-amd64 #1 SMP Mon Apr 30 05:20:23 UTC 2012 x86_64 GNU/Linux

$ mount
udev on /dev type devtmpfs (rw,relatime,size=1889948k,nr_inodes=472487,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=379196k,mode=755)
/dev/disk/by-uuid/2d38cf2e-38a9-4902-a7b2-92d34e037a74 on / type ext4 (rw,noatime,errors=remount-ro,user_xattr,acl,barrier=1,data=ordered)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,relatime,size=758388k)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /run/shm type tmpfs (rw,nosuid,nodev,relatime,size=758388k)
/dev/sda5 on /boot type ext4 (rw,noatime,user_xattr,acl,barrier=1,data=ordered)
/dev/sda9 on /home type ext4 (rw,noatime,user_xattr,acl,barrier=1,data=ordered)

$ ./python -m test test_os
[1/1] test_os
1 test OK.
msg161381 - (view) Author: Hynek Schlawack (hynek) * (Python committer) Date: 2012-05-22 21:04
I think the problem is that the xattr decorator checks only the file system with TESTFN for xattrs and the shutil functions use real temp files that live e.g. under /tmp.

Please try whether this patch helps.
msg161383 - (view) Author: Tshepang Lekhonkhobe (tshepang) * Date: 2012-05-22 21:19
patch works
msg161397 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-05-23 09:55
New changeset ab94ed2a8012 by Hynek Schlawack in branch 'default':
#14885: Make support.skip_unless_xattr check also tempfile
http://hg.python.org/cpython/rev/ab94ed2a8012
msg161398 - (view) Author: Hynek Schlawack (hynek) * (Python committer) Date: 2012-05-23 09:56
Awesome, thank you for your cooperation!
msg161428 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-05-23 16:02
FTR a few of us would prefer to kill TESTFN and use only tempfile in tests.  It’s cleaner.
msg161431 - (view) Author: Hynek Schlawack (hynek) * (Python committer) Date: 2012-05-23 16:17
It _does_ seem to me like cruft.

Ditching it won’t be easy though:

$ grep -PR TESTFN Lib/test | wc -l
    1390

But it’s good to know to actively avoid using TESTFN whenever possible. I usually adapted myself to module style till now.
History
Date User Action Args
2012-05-23 16:17:20hyneksetmessages: + msg161431
2012-05-23 16:02:52eric.araujosetnosy: + eric.araujo
messages: + msg161428
2012-05-23 09:56:22hyneksetstatus: open -> closed
resolution: fixed
messages: + msg161398

stage: resolved
2012-05-23 09:55:31python-devsetnosy: + python-dev
messages: + msg161397
2012-05-22 21:19:13tshepangsetmessages: + msg161383
2012-05-22 21:04:42hyneksetfiles: + test-tmp-for-xattr.diff
keywords: + patch
messages: + msg161381
2012-05-22 20:25:21tshepangsetmessages: + msg161378
2012-05-22 20:18:57hyneksetassignee: hynek
messages: + msg161377
2012-05-22 20:01:44tshepangcreate