Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
2008-02-27 Michal Ludvig <michal@logix.cz>
	* s3cmd: Fix crash when 'sync'ing files with unresolvable owner uid/gid.


git-svn-id: https://s3tools.svn.sourceforge.net/svnroot/s3tools/s3cmd/trunk@163 830e0280-6d2a-0410-9c65-932aecc39d9d
  • Loading branch information
ludvigm committed Feb 27, 2008
1 parent d8a573e commit bed7802
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions ChangeLog
@@ -1,6 +1,7 @@
2008-02-27 Michal Ludvig <michal@logix.cz>

* S3/S3.py, S3/Utils.py, s3cmd: Support for 's3cmd info' command.
* s3cmd: Fix crash when 'sync'ing files with unresolvable owner uid/gid.

2008-02-27 Michal Ludvig <michal@logix.cz>

Expand Down
14 changes: 12 additions & 2 deletions s3cmd
Expand Up @@ -298,9 +298,19 @@ def cmd_sync(args):
st = os.stat_result(os.stat(src))
for attr in cfg.preserve_attrs_list:
if attr == 'uname':
val = pwd.getpwuid(st.st_uid).pw_name
try:
val = pwd.getpwuid(st.st_uid).pw_name
except KeyError:
attr = "uid"
val = st.st_uid
warning("%s: Owner username not known. Storing UID=%d instead." % (src, val))
elif attr == 'gname':
val = grp.getgrgid(st.st_gid).gr_name
try:
val = grp.getgrgid(st.st_gid).gr_name
except KeyError:
attr = "gid"
val = st.st_gid
warning("%s: Owner groupname not known. Storing GID=%d instead." % (src, val))
else:
val = getattr(st, 'st_' + attr)
attrs[attr] = val
Expand Down

0 comments on commit bed7802

Please sign in to comment.