Menu

#6 Directory ownership not saved

open
nobody
None
5
2004-03-29
2004-03-29
Rohan Carly
No

I've found that flexbackup does not correctly preserve
the UID/GID of directories, despite the use of "tar --
same-owner". This seems to be due to the interaction
between "find" and "tar".

The problem can be fixed by dropping the "-depth"
argument to find, so that the directories appear in the
file list ahead of the contents of the directories.

I was able to fix the problem by commenting out the
following line in the file_list_cmd() subroutine:

$cmd .= "-depth ";

I use flexbackup v1.2.1, GNU find 4.1.7 and GNU tar
1.13.25.

Discussion

  • Charlie Brady

    Charlie Brady - 2005-04-21

    Logged In: YES
    user_id=345312

    > This seems to be due to the interaction
    > between "find" and "tar".

    I'm interested in what lead you to that conclusion. What are
    the observations?

    Are you backing up/restoring a root file system? If the
    contents of /etc/passwd changes midway through a tar
    restore, there's a chance that uid/gids will change. Before
    the update, files and directories will get the uid/gid
    corresponding to the named user and group from the old
    /etc/passwd. After the update, they'll get the uid/gid from
    the new passwd file.

    If you post your original observation - what uid/gid do you
    see, and what do you expect, and which files, directories,
    etc, then someone can diagnose exactly what the problem is.

    I suspect that the -depth just appears to work because of
    the change of sort order, and doesn't necessarily completely
    fix the problem.

     
  • Filippo Carletti

    Logged In: YES
    user_id=1255645

    Summary should be "Directory ownership not restored".
    Probably a bug in tar. If tar extracts a file in a directory
    that doesn't exist, it creates the directory with a "default
    owner" of root and it doesn't restore original ownership
    when it encounters that directory into the tar ball.

    True, it's a find+tar interaction problem.
    And true, not using -depth solves the problem becuase find
    traverses filesystems before descending into dirs by default.

     
  • Filippo Carletti

    Logged In: YES
    user_id=1255645

    It's a tar bug.
    I can reproduce with tar-1.13.25-4.7.1 but tar-1.14-4
    behaves correctly.

     
  • Charlie Brady

    Charlie Brady - 2005-12-20

    Logged In: YES
    user_id=345312

    > I can reproduce with tar-1.13.25-4.7.1 but tar-1.14-4
    > behaves correctly

    tar-1.13.25-4.7.1 seems to work correctly for me if I use
    --overwrite while extracting. See
    http://contribs.org/bugzilla/show_bug.cgi?id=259 for details.

     
  • Charlie Brady

    Charlie Brady - 2005-12-20

    Logged In: YES
    user_id=345312

    Filippo could you please change Subject to something like:

    -depth is wrong when creating tar archive

    Hmmm, perhaps -depth is always wrong.

    Thanks.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.