Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Behavior on hardlinks different from tar #14

Closed
hasufell opened this issue Jul 20, 2020 · 5 comments
Closed

Behavior on hardlinks different from tar #14

hasufell opened this issue Jul 20, 2020 · 5 comments

Comments

@hasufell
Copy link
Collaborator

hasufell commented Jul 20, 2020

Some GHC bindists have a weird quirk:

-rwxr-xr-x root/root 4642048 2020-07-20 17:24 ghc-8.0.2/utils/haddock/dist/build/tmp/haddock
hrwxr-xr-x root/root 0 2020-07-20 17:24 ghc-8.0.2/utils/haddock/dist/build/tmp/haddock link to ghc-8.0.2/utils/haddock/dist/build/tmp/haddock

The cli tar will unpack this somehow as one file... my haskell-tar fork tar-bytestring also manages to unpack this. libarchive will not unpack this file at all, leaving us with an empty directory.

I'm wondering if this is a bug or expected behavior.

libarchive/libarchive#1381

hasufell added a commit to hasufell/libarchive that referenced this issue Jul 20, 2020
This does not fix it for dynamic linking. There appears
to be no release yet.
@vmchale
Copy link
Owner

vmchale commented Jul 20, 2020

Oh dear. Hm. I wonder what Schily tar does; I'll have to dig into it.

vmchale added a commit that referenced this issue Jul 20, 2020
Fix hardlink handling for bundled sources wrt #14
@vmchale
Copy link
Owner

vmchale commented Jul 20, 2020

Looks like Schily tar does create the file but it has

star: current 'kexec-tools-2.0.17/purgatory/arch/i386/entry32-16.S' newer.

...i.e. it doesn't extract if the on-disk entry is newer. Hm :o

vanessa@vanessa-desktop /tmp 🌸 exa --all kexec-tools-2.0.17/purgatory/arch/i386/entry32-16.S
kexec-tools-2.0.17/purgatory/arch/i386/entry32-16.S
vanessa@vanessa-desktop /tmp 🌸 readlink -f kexec-tools-2.0.17/purgatory/arch/i386/entry32-16.S
/tmp/kexec-tools-2.0.17/purgatory/arch/i386/entry32-16.S

@vmchale
Copy link
Owner

vmchale commented Jul 20, 2020

Oh, and the Rust tar library core dumps :p

vanessa@vanessa-desktop /tmp 🌸 ~/.cargo/bin/star x kexec-tools-2.0.17.tar.xz 
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Custom { kind: AlreadyExists, error: TarError { desc: "failed to unpack `/tmp/kexec-tools-2.0.17/purgatory/arch/i386/entry32-16.S`", io: Custom { kind: AlreadyExists, error: "File exists (os error 17) when hard linking /tmp/kexec-tools-2.0.17/purgatory/arch/i386/entry32-16.S to /tmp/kexec-tools-2.0.17/purgatory/arch/i386/entry32-16.S" } } }', /home/vanessa/.cargo/registry/src/github.com-1ecc6299db9ec823/star-0.1.2/src/main.rs:271:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Aborted (core dumped)

@vmchale
Copy link
Owner

vmchale commented Jul 20, 2020

The go tar library seems to skip with a message...

vanessa@vanessa-desktop /tmp 🌸 arc unarchive ghc-8.0.2-x86_64-deb8-linux.tar.xz 
2020/07/20 16:33:34 [ERROR] Reading file in tar archive: file already exists: ghc-8.0.2/utils/haddock/dist/build/tmp/haddock
2020/07/20 16:33:34 [ERROR] Reading file in tar archive: file already exists: ghc-8.0.2/utils/hsc2hs/dist-install/build/tmp/hsc2hs
2020/07/20 16:33:34 [ERROR] Reading file in tar archive: file already exists: ghc-8.0.2/utils/ghc-pkg/dist-install/build/tmp/ghc-pkg
2020/07/20 16:33:34 [ERROR] Reading file in tar archive: file already exists: ghc-8.0.2/utils/hpc/dist-install/build/tmp/hpc
2020/07/20 16:33:34 [ERROR] Reading file in tar archive: file already exists: ghc-8.0.2/utils/runghc/dist-install/build/tmp/runghc
2020/07/20 16:33:34 [ERROR] Reading file in tar archive: file already exists: ghc-8.0.2/ghc/stage2/build/tmp/ghc-stage2
vanessa@vanessa-desktop /tmp 🌸 exa --all ghc-8.0.2/utils/haddock/dist/build/tmp/haddock
ghc-8.0.2/utils/haddock/dist/build/tmp/haddock
vanessa@vanessa-desktop /tmp 🌸 readlink -f ghc-8.0.2/utils/haddock/dist/build/tmp/haddock
/tmp/ghc-8.0.2/utils/haddock/dist/build/tmp/haddock

@hasufell
Copy link
Collaborator Author

Seems this is fixed by the latest sources:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants