[PATCH] Add user/group support to brackup

Gavin Carr gavin at openfusion.com.au
Fri May 28 20:00:51 UTC 2010

Hi Kostas,

On Fri, May 28, 2010 at 07:02:41PM +0200, Kostas Chatzikokolakis wrote:
> 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
> > settings.
> 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).
> Kostas
> PS. if a uid has no name then getpwuid returns undef, which might cause
> some warnings in as_rfc822()

Yes, good point, I didn't think about the uid-without-a-name case, should
handle that, although it's presumably fairly uncommon?

In terms of storing uids as well as names, do you think the value is 
worth the extra complexity? I kind of like the simple approach: if the 
user exists on the restoring box, well and good, otherwise just fallback
to using the restoring user, as we've done so far.

Not sure.


More information about the brackup mailing list