Issue1493
Created on 2009-10-22.19:18:48 by tzhou, last changed 2009-10-27.23:55:03 by pjenvey.
msg5258 (view) |
Author: Ting Zhou (tzhou) |
Date: 2009-10-22.19:18:47 |
|
As a root user, when calling tarfile.extractall() to extract a tarball
containing files owned by non-root, tarfile module throws the following
exception:
File "/home/tzhou/jython2.5.0/Lib/tarfile.py", line 1531, in extractall
self.extract(tarinfo, path)
File "/home/tzhou/jython2.5.0/Lib/tarfile.py", line 1568, in extract
self._extract_member(tarinfo, os.path.join(path, tarinfo.name))
File "/home/tzhou/jython2.5.0/Lib/tarfile.py", line 1568, in extract
self._extract_member(tarinfo, os.path.join(path, tarinfo.name))
File "/home/tzhou/jython2.5.0/Lib/tarfile.py", line 1660, in
_extract_member
self.chown(tarinfo, targetpath)
File "/home/tzhou/jython2.5.0/Lib/tarfile.py", line 1772, in chown
os.chown(targetpath, u, g)
File "/home/tzhou/jython2.5.0/Lib/tarfile.py", line 1772, in chown
os.chown(targetpath, u, g)
I looked at tarfile.py. It appears that if the euid of the calling user
is 0 (root), chown() method (which is called by extractall()) will
invoke os.chown(). The latter is not implemented by Jython.
FYI, I reproduced this on both a Ubuntu 8 server and Redhat EL 5.2
server. Jython interpreter version:
Jython 2.5.0 (Release_2_5_0:6476, Jun 16 2009, 13:33:26)
[Java HotSpot(TM) Server VM (Sun Microsystems Inc.)] on java1.6.0_07
|
msg5278 (view) |
Author: Philip Jenvey (pjenvey) |
Date: 2009-10-27.23:55:02 |
|
I've added os.chown in r6920 which our posix lib already supports, it even
falls back to forking a chown process when not using the native bits. So
we don't need to hasattr check it in tarfile
|
|
Date |
User |
Action |
Args |
2009-10-27 23:55:03 | pjenvey | set | status: open -> closed resolution: fixed messages:
+ msg5278 |
2009-10-24 01:44:15 | pjenvey | set | assignee: pjenvey nosy:
+ pjenvey |
2009-10-22 19:18:48 | tzhou | create | |
|