Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
0beab058
Commit
0beab058
authored
Feb 05, 2013
by
Hynek Schlawack
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#17076: Make copying of xattrs more permissive of missing FS support
Patch by Thomas Wouters.
parent
844b0e69
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
1 deletion
+21
-1
Lib/shutil.py
Lib/shutil.py
+7
-1
Lib/test/test_shutil.py
Lib/test/test_shutil.py
+11
-0
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/shutil.py
View file @
0beab058
...
@@ -142,7 +142,13 @@ if hasattr(os, 'listxattr'):
...
@@ -142,7 +142,13 @@ if hasattr(os, 'listxattr'):
"""
"""
for
name
in
os
.
listxattr
(
src
,
follow_symlinks
=
follow_symlinks
):
try
:
names
=
os
.
listxattr
(
src
,
follow_symlinks
=
follow_symlinks
)
except
OSError
as
e
:
if
e
.
errno
not
in
(
errno
.
ENOTSUP
,
errno
.
ENODATA
):
raise
return
for
name
in
names
:
try
:
try
:
value
=
os
.
getxattr
(
src
,
name
,
follow_symlinks
=
follow_symlinks
)
value
=
os
.
getxattr
(
src
,
name
,
follow_symlinks
=
follow_symlinks
)
os
.
setxattr
(
dst
,
name
,
value
,
follow_symlinks
=
follow_symlinks
)
os
.
setxattr
(
dst
,
name
,
value
,
follow_symlinks
=
follow_symlinks
)
...
...
Lib/test/test_shutil.py
View file @
0beab058
...
@@ -449,6 +449,17 @@ class TestShutil(unittest.TestCase):
...
@@ -449,6 +449,17 @@ class TestShutil(unittest.TestCase):
self
.
assertIn
(
'user.bar'
,
os
.
listxattr
(
dst
))
self
.
assertIn
(
'user.bar'
,
os
.
listxattr
(
dst
))
finally
:
finally
:
os
.
setxattr
=
orig_setxattr
os
.
setxattr
=
orig_setxattr
# the source filesystem not supporting xattrs should be ok, too.
def
_raise_on_src
(
fname
,
*
,
follow_symlinks
=
True
):
if
fname
==
src
:
raise
OSError
(
errno
.
ENOTSUP
,
'Operation not supported'
)
return
orig_listxattr
(
fname
,
follow_symlinks
=
follow_symlinks
)
try
:
orig_listxattr
=
os
.
listxattr
os
.
listxattr
=
_raise_on_src
shutil
.
_copyxattr
(
src
,
dst
)
finally
:
os
.
listxattr
=
orig_listxattr
# test that shutil.copystat copies xattrs
# test that shutil.copystat copies xattrs
src
=
os
.
path
.
join
(
tmp_dir
,
'the_original'
)
src
=
os
.
path
.
join
(
tmp_dir
,
'the_original'
)
...
...
Misc/NEWS
View file @
0beab058
...
@@ -163,6 +163,9 @@ Core and Builtins
...
@@ -163,6 +163,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #17076: Make copying of xattrs more permissive of missing FS support.
Patch by Thomas Wouters.
- Issue #17089: Expat parser now correctly works with string input not only when
- Issue #17089: Expat parser now correctly works with string input not only when
an internal XML encoding is UTF-8 or US-ASCII. It now accepts bytes and
an internal XML encoding is UTF-8 or US-ASCII. It now accepts bytes and
strings larger than 2 GiB.
strings larger than 2 GiB.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment