The following patch seems to work for restoring user id/group id (ownership) data to files on linux. As far as I know it is only possible to use uid/gid to restore file ownership using python. Change filenames or cut and paste code as appropriate.
This makes linux full or partial file system recovery using sync command workable.
--- s3cmd.orig 2012-06-05 15:44:52.000000000 -0400
+++ s3cmd 2012-06-05 14:28:09.000000000 -0400
@@ -755,6 +755,8 @@
atime = attrs.has_key('atime') and int(attrs['atime']) or int(time.time())
os.utime(dst_file, (atime, mtime))
## FIXME: uid/gid / uname/gname handling comes here! TODO
+ if attrs.has_key('uid') and attrs.has_key('gid'):
+ os.chown(dst_file, int(attrs['uid']), int(attrs['gid']))
except OSError, e: