[PATCH] Add user/group support to brackup
kostas at chatzi.org
Fri May 28 17:02:41 UTC 2010
On 28/05/10 17:39, Gavin Carr wrote:
> Brackup currently lacks support for recording and restoring ownership.
> The attached patches add this functionality, in a similar way to how
> modes are stored in the metafile currently. The first patch updates
> Brackup::File and Brackup::Backup to capture user and group ownership
> for all objects in the metafile; the second patch updates
> Brackup::Restore to reapply (where possible) the recorded user/group
That's a nice and needed feature!
Just one comment: from a quick look at the patch I see that you store
names, not ids. It would be nice if brackup could also record the
uid/gid, like tar. Note that a file might have a uid without name in the
original system, or the name might not exist in the restore system.
A good solution would be to store ids (which are shorter) for each file
and also store the id -> name map in the metafile. Then, on restore, we
can apply the local uid for that name, unless it doesn't exist (or some
--numeric-owner option is given) in which case we can restore the
original uid (this is how tar works).
PS. if a uid has no name then getpwuid returns undef, which might cause
some warnings in as_rfc822()
More information about the brackup