rdiff-backup-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[rdiff-backup-users] [PATCH] importing user_group in a native windows en


From: Fred Gansevles
Subject: [rdiff-backup-users] [PATCH] importing user_group in a native windows environment
Date: Fri, 27 Jun 2008 09:59:13 +0200
User-agent: Thunderbird 2.0.0.14 (X11/20080501)

After applying Josh Nisly's patches to use rdiff-backup on windows without using cygwin, importing the user_group module raises an ImportError. Since the grp and pwd modules, which user_group uses, are not available in a native windows environment, running rdiff-backup will fail. The user_group module is not needed when using the win_acls extension, because the user and group information of files is stored in the win_acl (in fact, the SecurityDescriptor is stored, containing the Owner, Group and ACLs)
So to be able to use rdiff-backup, the attached patch must be appied.

Fred Gansevles
address@hidden


--- rdiff_backup/user_group.py  2008-06-18 02:21:43.000000000 +0200
+++ rdiff_backup/user_group.py  2008-06-26 14:08:08.901755077 +0200
@@ -30,7 +30,11 @@
 
 """
 
-import grp, pwd
+try:
+    import grp, pwd
+except ImportError:
+    pass
+
 import log, Globals
 
 ############ "Private" section - don't use outside user_group ###########
@@ -163,7 +167,7 @@
        try: return uid2uname_dict[uid]
        except KeyError:
                try: uname = pwd.getpwuid(uid)[0]
-               except (KeyError, OverflowError), e: uname = None
+               except (KeyError, OverflowError, NameError), e: uname = None
                uid2uname_dict[uid] = uname
                return uname
 
@@ -172,7 +176,7 @@
        try: return gid2gname_dict[gid]
        except KeyError:
                try: gname = grp.getgrgid(gid)[0]
-               except (KeyError, OverflowError), e: gname = None
+               except (KeyError, OverflowError, NameError), e: gname = None
                gid2gname_dict[gid] = gname
                return gname
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]