mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-24 12:12:19 +03:00
Ticket #2297: show empty directories in incremental tar archives.
How to reproduce: 1. Create two tar files with empty dir: $ mkdir -p dir/dir1; mkdir dir/dir2; touch dir/dir1/file $ tar cf normal.tar dir/ $ tar cf incremental.tar -g incremental.snap dir/ 2. Press Enter to enter to normal.tar. Result: normal.tar contains dir/dir2, incremental.tar doesn't. Expected result: incremental.tar contains dir/dir2. This patch also fixes Ticket #3709: Wrong directories owner for tar --numeric-owner -g. How to reproduce: As root: # mkdir -p TEST/TEST2 # echo aaa > TEST/TEST2/aaa.txt # chown 10000:10000 TEST # chown 10001:10001 TEST/TEST2 # chown 10002:10002 TEST/TEST2/aaa.txt # tar --numeric-owner -zcf test1.tar.gz TEST # tar --numeric-owner -g test.inc -zcf test2.tar.gz TEST and now view these tarballs with long view. Directories of test2.tar.gz have owner root instead of 10000 or 10001, but if you untar them using tar -xvf directories owners are correct Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
59b12cf2cb
commit
49898835fd
@ -388,7 +388,7 @@ tar_fill_stat (struct vfs_s_super *archive, struct stat *st, union record *heade
|
|||||||
* know about the other modes but I think I cause no new
|
* know about the other modes but I think I cause no new
|
||||||
* problem when I adjust them, too. -- Norbert.
|
* problem when I adjust them, too. -- Norbert.
|
||||||
*/
|
*/
|
||||||
if (header->header.linkflag == LF_DIR)
|
if (header->header.linkflag == LF_DIR || header->header.linkflag == LF_DUMPDIR)
|
||||||
st->st_mode |= S_IFDIR;
|
st->st_mode |= S_IFDIR;
|
||||||
else if (header->header.linkflag == LF_SYMLINK)
|
else if (header->header.linkflag == LF_SYMLINK)
|
||||||
st->st_mode |= S_IFLNK;
|
st->st_mode |= S_IFLNK;
|
||||||
@ -554,15 +554,10 @@ tar_read_header (struct vfs_class *me, struct vfs_s_super *archive, int tard, si
|
|||||||
else
|
else
|
||||||
*h_size = tar_from_oct (1 + 12, header->header.size);
|
*h_size = tar_from_oct (1 + 12, header->header.size);
|
||||||
|
|
||||||
/*
|
|
||||||
* Skip over directory snapshot info records that
|
|
||||||
* are stored in incremental tar archives.
|
|
||||||
*/
|
|
||||||
if (header->header.linkflag == LF_DUMPDIR)
|
if (header->header.linkflag == LF_DUMPDIR)
|
||||||
{
|
{
|
||||||
if (arch->type == TAR_UNKNOWN)
|
if (arch->type == TAR_UNKNOWN)
|
||||||
arch->type = TAR_GNU;
|
arch->type = TAR_GNU;
|
||||||
return STATUS_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user