[issue6856] allow setting uid and gid when creating tar files

Lars Gustäbel report at bugs.python.org
Mon Sep 7 18:25:44 CEST 2009


Lars Gustäbel <lars at gustaebel.de> added the comment:

I do not quite see the benefit from the set_* methods. Although the
attribute access I proposed may be slightly more complicated (because
you might need the pwd and grp modules) it offers the most freedom.
Let's take the set_uid() method as an example: Its purpose would be to
set both the uid and uname field in the tar header. That is fine as long
as its argument is a uid or username that actually exists. If set_uid()
gets a username that does not exist, what are we going to do? Only set
the uname field and leave the uid field alone or raise an exception? If
the user wants to set a non-existant username on purpose, he cannot use
the set_uid() method. And what are we going to do on Windows? Is there
anything comparable to pwd/grp we could use?
I expect the common use case for these both methods will be to *reset*
the owner information to a default, and this is done by setting uname to
"root" and uid to 0.

The filter argument is actually a nice idea. I have attached a patch
that outlines my idea of how it is supposed to be. Comments welcome.

----------
keywords: +patch
Added file: http://bugs.python.org/file14853/issue6856.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6856>
_______________________________________


More information about the Python-bugs-list mailing list