-
Notifications
You must be signed in to change notification settings - Fork 6
unpackArchive/unpackToDirLazy uses current directory for referencing hardlinks #4
Copy link
Copy link
Open
Description
Looks like there is an issue in unpackArchive. I found it out when some of archives that I unpacked with unpackToDirLazy were missing hard links.
What is interesting is that readArchiveFile reads entries successfully and with appropriate type. I was suspecting order between hardlink and target, but bsdtar/tar shows in correct order.
There was another assumption that implementation of writing to filesystem for hard-links doesn't take into account the fact that contrary to symlinks they are referring relative to target dir. But I was able to confirm when I create archive via chain of entriesToBSL -> unpackToDirLazy -> packFiles -> readArchiveBSL there were no loss of entries.
Test run based on PR #2
zsh% cabal v1-build && ./dist/build/libarchive-test/libarchive-test --ignore-dot-hspec
Preprocessing library for libarchive-2.0.0.2..
Building library for libarchive-2.0.0.2..
Preprocessing test suite 'libarchive-test' for libarchive-2.0.0.2..
Building test suite 'libarchive-test' for libarchive-2.0.0.2..
roundtrip
sucessfully unpacks/packs (test/data/hard-links-bsd.tar)
with symlinks
packs/unpacks successfully without loss
packs/unpacks on filesystem successfully without loss
with hardlinks
packs/unpacks successfully without loss
packs/unpacks on filesystem successfully without loss
with forward referenced hardlinks
packs/unpacks successfully without loss
FIXME
packs/unpacks on filesystem successfully without loss
# PENDING: No reason given
having entry without ownership
packs/unpacks successfully without loss
# PENDING: No reason given
having entry without timestamp
packs/unpacks successfully without loss
# PENDING: No reason given
archive samples
hard-links
via readArchiveFile
should succeed
should contain entry for hard-links/a.txt
should contain entry for hard-links/b.txt
via unpackArchive
should succeed
should contain hard-links/a.txt FAILED [1]
should contain hard-links/b.txt
Failures:
test/Spec.hs:133:25:
1) archive samples, hard-links, via unpackArchive, should contain hard-links/a.txt
expected: True
but got: False
To rerun use: --match "/archive samples/hard-links/via unpackArchive/should contain hard-links/a.txt/"
Randomized with seed 1788580387
Finished in 0.0053 seconds
15 examples, 1 failure, 3 pending
zsh% bsdtar tvvf test/data/hard-links-bsd.tar
drwxr-xr-x 0 nikolay nikolay 0 Dec 1 12:07 hard-links/
-rw-r--r-- 0 nikolay nikolay 7 Dec 1 12:07 hard-links/b.txt
hrw-r--r-- 0 nikolay nikolay 0 Dec 1 12:07 hard-links/a.txt link to hard-links/b.txt
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels