Bug 257817 - tar/libarchive: cannot archive/recreate hardlinks to absolute symlinks
Summary: tar/libarchive: cannot archive/recreate hardlinks to absolute symlinks
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 13.0-RELEASE
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks: 252184
  Show dependency treegraph
 
Reported: 2021-08-13 17:20 UTC by Matthias Andree
Modified: 2021-08-14 02:09 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Andree freebsd_committer freebsd_triage 2021-08-13 17:20:14 UTC
+++ This bug was initially created as a clone of Bug #257816 +++

affects FreeBSD 12.2 and 13.0

after a user reports against e2fsprogs, I conclude that restore(8) is broken and cannot faithfully recreate a hardlink to a symbolic link.

tar(1) with libarchive(3) fails in a similar vain.

I am attaching a demo script that uses two 20M sized swap-based md(4) devices, formats them with newfs -U and sets up some corner cases with symlinks 

### The error in question is, for dump/restore on 13.0:

restore:
warning: cannot create hard link ./usr/local/sbin/hardlink-to-abssymlink->./usr/local/sbin/abssymlink: No such file or directory

mtree verification:
sbin/file: 
        link count (1, 2)
usr/local/sbin/abssymlink: 
        link count (2, 1)
usr/local/sbin/relsymlink: 
        link count (2, 1)
usr/local/sbin/hardlink-to-relsymlink: 
        type (link, file)
./usr/local/sbin/hardlink-to-abssymlink missing


and consequential differences shown with mtree.

### The error in question is, for tar (libarchive) on 13.0:

./usr/local/sbin/hardlink-to-abssymlink: Hard-link target './usr/local/sbin/abssymlink' does not exist.
./usr/local/sbin/hardlink-to-relsymlink: Hard-link target './usr/local/sbin/relsymlink' does not exist.

mtree verification:
.:      modification time (Fri Aug 13 19:12:46 2021, Fri Aug 13 19:12:47 2021)
./usr/local/sbin/abssymlink missing
./usr/local/sbin/hardlink-to-abssymlink missing
./usr/local/sbin/hardlink-to-relsymlink missing
./usr/local/sbin/relsymlink missing



### gtar from the gtar-1.34 (archivers/gtar) succeeds!