From ad458a91dc96e7ba50bff6a45205db69b6befa41 Mon Sep 17 00:00:00 2001 From: bescoto Date: Mon, 15 Sep 2003 03:00:11 +0000 Subject: Changed handling of ownership, added --user/group-mapping-file options git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@436 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109 --- rdiff-backup/CHANGELOG | 14 ++++++-- rdiff-backup/TODO | 2 -- rdiff-backup/dist/makedist | 3 +- rdiff-backup/rdiff-backup.1 | 63 +++++++++++++++++++++++++++++---- rdiff-backup/rdiff_backup/Globals.py | 5 --- rdiff-backup/rdiff_backup/Main.py | 36 ++++++++++++++----- rdiff-backup/rdiff_backup/connection.py | 2 +- rdiff-backup/rdiff_backup/increment.py | 7 ++-- rdiff-backup/rdiff_backup/metadata.py | 8 +++++ rdiff-backup/rdiff_backup/rpath.py | 63 +++++++++++++++++++++++++-------- rdiff-backup/rdiff_backup/user_group.py | 9 +++-- rdiff-backup/testing/commontest.py | 7 ++-- rdiff-backup/testing/roottest.py | 45 +++++++++++++++++++++++ 13 files changed, 210 insertions(+), 54 deletions(-) diff --git a/rdiff-backup/CHANGELOG b/rdiff-backup/CHANGELOG index 8189e6e..3b7546e 100644 --- a/rdiff-backup/CHANGELOG +++ b/rdiff-backup/CHANGELOG @@ -1,6 +1,9 @@ New in v0.13.2 (??????????) --------------------------- +Change ownership policy and added --user-mapping-file and +--group-mapping-file switches. See man page for more information. + Specified socket type as SOCK_STREAM. (Error reported by Erik Forsberg.) @@ -13,9 +16,11 @@ If there is data missing from the destination dir (for instance if a user mistakenly deletes it), only warn when restoring, instead of exiting with error. -Fixed bug in EA/ACL restoring, noticed by Greg Freemyer. Also updated -quoting of filenames and extended attributes names to match -forthcoming attr/facl utilities. +Fixed bug in EA/ACL restoring, noticed by Greg Freemyer. + +Updated quoting of filenames and extended attributes names to match +forthcoming attr/facl utilities. Strange characters should now be +properly escaped. Fixed problems with --restrict options that would cause proper sessions to fail. Thanks to Randall Nortman for error report. @@ -27,6 +32,9 @@ by Alan Bailward. File examples.html added to distribution; examples section removed from man page. +Removed option --no-change-dir-inc-perms. Instead when copying +permissions to directory increments, mask with 0777. + New in v0.13.1 (2003/08/08) --------------------------- diff --git a/rdiff-backup/TODO b/rdiff-backup/TODO index 50204ca..e958f5e 100644 --- a/rdiff-backup/TODO +++ b/rdiff-backup/TODO @@ -1,5 +1,3 @@ -Look at manual page examples. - Consider adding --datadir option (Jean-Sébastien GOETSCHY) See if regressing takes too much memory (large directories). diff --git a/rdiff-backup/dist/makedist b/rdiff-backup/dist/makedist index 93375ab..d0c2189 100755 --- a/rdiff-backup/dist/makedist +++ b/rdiff-backup/dist/makedist @@ -116,7 +116,8 @@ def MakeTar(): "robust.py", "rorpiter.py", "rpath.py", "Security.py", "selection.py", "SetConnections.py", "static.py", - "statistics.py", "TempFile.py", "Time.py"]: + "statistics.py", "TempFile.py", "Time.py", + "user_group.py"]: assert not os.system("cp %s/%s %s/rdiff_backup" % (SourceDir, filename, tardir)), filename diff --git a/rdiff-backup/rdiff-backup.1 b/rdiff-backup/rdiff-backup.1 index 865154d..31f93b5 100644 --- a/rdiff-backup/rdiff-backup.1 +++ b/rdiff-backup/rdiff-backup.1 @@ -134,6 +134,13 @@ Exclude all device files, fifos, sockets, and symlinks. Authorize the updating or overwriting of a destination path. rdiff-backup will generally tell you if it needs this. .TP +.BI "--group-mapping-file " filename +Map group names and ids according the the group mapping file +.IR filename . +See the +.B USERS AND GROUPS +section for more information. +.TP .BI "--include " shell_pattern Similar to .B --exclude @@ -198,10 +205,6 @@ to --remove-older-than. Specifying a subdirectory is allowable; then only the sizes of the mirror and increments pertaining to that subdirectory will be listed. .TP -.B --no-change-dir-inc-perms -Do not change the permissions of the directory increments to match the -directories they represent. -.TP .B --no-compare-inode This relatively esoteric option prevents rdiff-backup from flagging a file as changed when its inode changes. This option may be useful if @@ -338,6 +341,13 @@ Test for the presence of a compatible rdiff-backup server as specified in the following host::filename argument(s). The filename section will be ignored. .TP +.BI "--user-mapping-file " filename +Map user names and ids according to the user mapping file +.IR filename . +See the +.B USERS and GROUPS +section for more information. +.TP .BI -v [0-9] ", --verbosity " [0-9] Specify verbosity level (0 is totally silent, 3 is the default, and 9 is noisiest). This determines how much is written to the log file. @@ -735,8 +745,50 @@ matches any files whose full pathnames contain 7 consecutive digits which aren't followed by 'foo'. However, it wouldn't match /home even if /home/ben/1234567 existed. -.SH STATISTICS +.SH USERS AND GROUPS +There can be complications preserving ownership across systems. For +instance the username that owns a file on the source system may not +exist on the destination. Here is how rdiff-backup maps ownership on +the source to the destination: + +.TP +.B 1. +Attempt to preserve the user and group names for ownership and in +ACLs. This may result in files having different uids and gids across +systems. +.TP +.B 2. +If this fails (e.g. because the username does not exist), preserve the +original id, but only in cases of user and group ownership. For ACLs, +omit any entry that has a bad user or group name. +.TP +.B 3. +However, the +.B --user-mapping-file +and +.B --group-mapping-file +options can override this behavior. If either of these options is +given, the policy descriped in 1 and 2 above will be followed, but +with the mapped user and group instead of the original. + +.RE +The user and group mapping files both have the same form: + +.RS +old_name_or_id1:new_name_or_id1 +.RE +.RS +old_name_or_id2:new_name_or_id2 +.RE +.RS + +.RE +Each line should contain a name or id, followed by a colon ":", +followed by another name or id. If a name or id is not listed, they +are treated in the default way described above. + +.SH STATISTICS Every session rdiff-backup saves various statistics into two files, the session statistics file at rdiff-backup-data/session_statistics.