tar: repeated hard-link members fail during extraction
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 52/100
Research direction
Start by reproducing the archive cases with the provided tar commands, then inspect tar-rs 0.4.46's hard-link path and compare it with the symlink overwrite path. The fix is complete when an already-satisfied self-link, repeated extraction, and replacement of existing destinations with overwrite enabled all match GNU tar without errors.
Written by the indexing model from the issue text.
Description
An archive may contain a regular member followed by a hard-link entry with the same name. GNU tar accepts this, but uutils reports an extraction error.
mkdir src gnu uutils
printf hello > src/a
(cd src && tar -cf ../x.tar a a)
tar -tvf x.tar
(cd gnu && tar -xf ../x.tar)
(cd uutils && tarapp -xf ../x.tar)
GNU tar 1.35 exits 0 with empty stderr. The current uutils build exits 2 with Cannot extract 'a', although the resulting file contains hello.
The related overwrite case fails as well. If an archive contains regular file a followed by hard links b and c, extracting it twice into the same directory succeeds with GNU but fails on the second uutils extraction. GNU also replaces pre-existing, unrelated files named b and c; uutils does not.
The error comes from tar-rs 0.4.46. Its hard-link path returns fs::hard_link errors directly, while the symlink path removes an existing destination and retries when overwrite is enabled. A complete fix needs to handle two cases in the right order: accept a self-link that is already satisfied, and replace a different existing destination when overwrite is allowed. Deleting first would break the self-link case.
This may belong in tar-rs; composefs/tar-rs#319 is related but does not cover the self-link case as written. Would you prefer an upstream tar-rs fix, or a narrow check in uutils while that is unresolved?
- Dominant language
- Rust
- Stars
- 51
- Forks
- 17
- Avg merge
- 8h 6m
- Merged PRs (30d)
- 31
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from uutils/tar
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
tar: listing a member can lose its original name bytesPossibly taken @SichenLiang claimed this 16 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
Maintainers usually reply within 1 day
-
TarError::Io returns exit code 2, GNU tar returns exit code 141Possibly taken @MsfPablo claimed this 35 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 55/100
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
521xueweihan/HelloGitHub#4023 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
cloudflare/pingora#1055 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day