Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #35810 > unrolled thread

Re: Tarfile and usernames

Started byAlbert Hopkins <marduk@letterboxes.org>
First post2012-12-30 15:07 -0500
Last post2012-12-30 15:07 -0500
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Tarfile and usernames Albert Hopkins <marduk@letterboxes.org> - 2012-12-30 15:07 -0500

#35810 — Re: Tarfile and usernames

FromAlbert Hopkins <marduk@letterboxes.org>
Date2012-12-30 15:07 -0500
SubjectRe: Tarfile and usernames
Message-ID<mailman.1470.1356898033.29569.python-list@python.org>

[Multipart message — attachments visible in raw view] — view raw





On Sun, Dec 30, 2012, at 01:57 PM, Nicholas Cole wrote:

Dear List,

I'm hoping to use the tarfile module in the standard library to move
some files between computers.

I can't see documented anywhere what this library does with userids and
groupids.  I can't guarantee that the computers involved will have the
same users and groups, and would like the archives to be extracted so
that the files are all owned by the extracting user.

Essentially, I do *not* with to preserve the owner and groups specified
in the archives.


Each "member" in the tar file has misc. metadata associated with it,
which can be retrieved with the get_info() method.  You can add/modify
this metadata if creating a TarFile.

However, it should be stated that by default (on *nix anyway) if the
user is not root then user/groups are assigned to the user exctracting
the file (because only root can assign userids/non-member-groups).
The TarFile extract*() methods pretty much inherit the same behavior as
the *nix tar command.  So if you are extracting as a non-root user, you
should expect the same behavoir.  If you are extracting as root but
don't want to change user/groups may have to extract it manually or
create your own class by inheriting TarFile and overriding the .chown()
method.

-a

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web