tar: listing a member can lose its original name bytes
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 68/100
Research direction
Reproduce the issue with the provided Python script and compare tar -t and tar -tv output against GNU tar. Locate the member-name formatting path used by listing mode, then inspect nearby tests or add coverage for invalid bytes, newlines, ESC, and locale-sensitive names. Done means listing preserves distinct names through GNU-compatible quoting without changing the explicitly excluded output modes.
Written by the indexing model from the issue text.
Description
On Linux, tar -t and tar -tv do not quote member names. A newline is written as an actual line break, ESC is sent to the terminal, and invalid bytes are replaced with U+FFFD. Two distinct names can therefore produce the same listing.
The following creates an archive member containing byte ff and compares the raw output with GNU tar 1.35:
LC_ALL=C python3 - <<'PY'
import os, subprocess, tempfile
app = os.path.abspath('target/release/tarapp')
with tempfile.TemporaryDirectory() as d:
name = b'bad-\xff'
path = os.fsencode(d) + b'/' + name
fd = os.open(path, os.O_WRONLY | os.O_CREAT, 0o600)
os.write(fd, b'x')
os.close(fd)
archive = os.path.join(d, 'a.tar')
subprocess.run(
[b'/usr/bin/tar', b'-cf', os.fsencode(archive), b'-C', os.fsencode(d), name],
check=True,
)
for label, program in [('GNU', '/usr/bin/tar'), ('uutils', app)]:
p = subprocess.run([program, '-tf', archive], capture_output=True)
print(label, p.returncode, repr(p.stdout), repr(p.stderr))
PY
GNU prints b'bad-\\377\n'; uutils prints b'bad-\xef\xbf\xbd\n'. Both exit 0 with empty stderr.
GNU also prints a newline in a name as \n. Under LC_ALL=C, it prints café as caf\303\251; under C.UTF-8, it leaves café unchanged.
This issue is limited to member names in -t and -tv output. Quoting options, verbose create/extract output, verbose link targets, and the owner/group columns are separate work.
- 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
-
Difficulty 4/5 3-5 days Newbie friendliness 52/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 37 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
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
charles-hood/DiagramCraft#73 ·
-
Difficulty 1/5 1-3 hours Newbie friendliness 78/100
ontologyportal/sigma-rs#200 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
chipsalliance/caliptra-sw#4311 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
`image_generation`: `max_retries` is ignored for OpenAI-compatible providers (always 2 retries)Possibly taken @ericz7900 claimed this today. Openllm translation
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
Maintainers usually reply within 1 day