Message5258

Author tzhou
Recipients tzhou
Date 2009-10-22.19:18:47
SpamBayes Score 0.0018945582
Marked as misclassified No
Message-id <1256239128.21.0.21799602154.issue1493@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2009-10-22 19:18:48tzhousetrecipients: + tzhou
2009-10-22 19:18:48tzhousetmessageid: <1256239128.21.0.21799602154.issue1493@psf.upfronthosting.co.za>
2009-10-22 19:18:48tzhoulinkissue1493 messages
2009-10-22 19:18:47tzhoucreate