Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

tar: repeated hard-link members fail during extraction

Open
#382 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
52/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
rust
Domain
cli

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

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from uutils/tar

All issues in uutils/tar

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.