Hello, When extracting a directory, GNU tar tries to postpone chmod'ing a freshly created directory until after extracting all files and subdirectories under it (otherwise extracting files under a readonly directory would fail).
Unfortunately, it chmods as soon as it encounters an item in the archive that would fall outside the directory. It usually works (as long as GNU tar uses a DFS-like walk to create recursive archives), but if the archive was appended to, or created by another producer, it may cause a failure. In practice, this causes errors when extracting Archlinux rootfs archives from a non-root user. The "bsdtar" tool from libarchive handles them without issue (by postponing chmod operations until end of extraction). The following commands perform a minimal demonstration: # Create the directory/file structure to be archived $ mkdir -p dir/subdir $ touch dir/subdir/file1 dir/file2 $ chmod a-w dir/subdir # Using '--no-recursion' for the sake of minimal example, in practice # a problematic archive may be created in other ways too $ tar --no-recursion -cvf t.tar dir/{subdir,file2,subdir/file1} dir/subdir/ dir/file2 dir/subdir/file1 # Move the original out of the way $ mv dir dir~ # Attempt to extract the archive $ tar xvf t.tar dir/subdir/ dir/file2 dir/subdir/file1 tar: dir/subdir/file1: Cannot open: Permission denied tar: Exiting with failure status due to previous errors Please keep me Cc'ed, I am not subscribed. Regards, Alexander