-
-
Notifications
You must be signed in to change notification settings - Fork 31.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
shutil.copystat should copy Linux extended attributes #59443
Comments
3.3 adds the *xattr() extended attribute functions on Linux. shutil implements a new internal function(_copyxattr) which copies these extended attributes. However, it's only used in shutil.copy2(). I assert that shutil.copystat() should also preserve this metadata. (Which, having subsumed this functionality, means that shutil.copy2() would no longer need to explicitly call it.) Also: it might be worth considering taking the same approach _copyxattr uses for the other conditional functionality (see "def lookup" inside copystat). Computing platform support at import time instead of runtime looks cleaner. Georg, how much of this (if any) do you consider a 3.3 bugfix? |
First patch. |
The patch looks good enough. Not sure if we should write Linux though. I sincerely hope we’ll support xattrs on other OSes soonish. Did you catch Georg somewhere whether this can still go in? Would be nice as xattrs are new to 3.3. Changing this in 3.4 would be rather unfortunate. |
Yeah, good to go. But please re-insert a blank line in the test suite changes after the end of the method. |
Georg: done. Hynek: You must forgive me, I'm a recovering Windows programmer. I thought extended attributes were a Linux-only thing. Can you tell me what other platforms they are available on? And/or suggest some alternate language? |
See open bpo-12978. |
http://en.wikipedia.org/wiki/Xattr has a list. The question what’s most However as I see it, we’re deep down this path already anyway One nit: I’d swap your quoted "extended attributes" to unquoted but |
New changeset 5f62c317c202 by Larry Hastings in branch 'default':
|
The new test fails on the Fedora bot: ====================================================================== Traceback (most recent call last):
File "/home/buildbot/buildarea/3.x.krah-fedora/build/Lib/test/test_shutil.py", line 420, in test_copyxattr
self.assertEqual(os.listxattr(src), ['user.the_value'])
AssertionError: Lists differ: ['security.selinux', 'user.the... != ['user.the_value'] First differing element 0: First list contains 1 additional elements.
|
You can’t just compare the xattr because some (like security.*) can be |
Hynek, it's clear you understand this far better than I do. Could I get you to fix the Fedora buildbot problem, etc, etc? |
New changeset 265e36e277f3 by Hynek Schlawack in branch 'default': |
I removed the check for good as we check for the existence of the xattr in the next line. However we check the destination now whether the xattrs have been copied. ;) Fedora is green again. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: