Repository navigation
tar: a long option may be any unambiguous prefix of its name - #30
Merged
Merged
Conversation
GNU tar takes any unambiguous prefix of a long option (getopt_long), and bsdtar does too, so "tar xz --strip 1" extracts with both; this tar refused it as "unrecognized option '--strip'", exit 64. limen v0.14.0 puts this tar first on the hermetic PATH, where farcloser/tarmac's init pipes a tarball into exactly that command and failed on it. The long-option parser resolves the given name first: an option's whole name is that option, else the one option it is a prefix of; no option is unrecognized as before, several are "option '--ver' is ambiguous; possibilities: '--verbose' '--version'", GNU tar's wording, exit 64. A whole name wins over the options it prefixes: --file is --file, not ambiguous against --files-from, the one such pair in the tables. The argument rules are unchanged and name the resolved option, as glibc does. An empty name (--=x) is unrecognized under its own spelling. Tests: TestLongOptionAbbreviation creates with --cre --file --dir --verb --xz --files-from and extracts with --extr --strip 1 and --ext --strip=1 --directory, the tarmac shape; TestUsage gains the unrecognized prefix, two ambiguous ones (--ver, --same) and --=x. Each fails against the previous parser. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: closer-claudio <[email protected]>
closer-claudio
enabled auto-merge
October 19, 2026 05:39
Contributor
Author
|
Reviewed at f7ecb18 |
apostasie
approved these changes
Oct 19, 2026
closer-claudio
added a commit
to farcloser/limen
that referenced
this pull request
Oct 19, 2026
forkcloser/compress v0.3.0 carries the tar member-subset extraction fix (forkcloser/compress#24), the long-option prefix fix (forkcloser/compress#30), seekable xz (forkcloser/compress#20) and xz v1.1.2 (forkcloser/compress#31); the canonical tool set pins it, with the checksums regenerated. forkcloser/dot v1.3.1 moves in .limen/tools/go.mod, lifting its go-graphviz and x/image requirements as tidy demands. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: closer-claudio <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GNU tar takes any unambiguous prefix of a long option (getopt_long), and bsdtar does too, so
tar xz --strip 1extracts with both; this tar refused it as "unrecognized option '--strip'", exit 64. limen v0.14.0 puts this tar first on the hermetic PATH, where farcloser/tarmac's init pipes a tarball into exactly that command and failed on it (farcloser/tarmac#11).The long-option parser resolves the given name first: an option's whole name is that option, else the one option it is a prefix of; no option is unrecognized as before, several are "option '--ver' is ambiguous; possibilities: '--verbose' '--version'", GNU tar's wording, exit 64. A whole name wins over the options it prefixes:
--fileis--file, not ambiguous against--files-from, the one such pair in the tables. The argument rules are unchanged and name the resolved option, as glibc does. An empty name (--=x) is unrecognized under its own spelling. The package doc and the README each gain a sentence.Tests:
TestLongOptionAbbreviationcreates with--cre --file --dir --verb --xz --files-fromand extracts with--extr --strip 1and--ext --strip=1 --directory, the tarmac shape;TestUsagegains the unrecognized prefix, two ambiguous ones (--ver,--same) and--=x. Each fails against the previous parser.gzip and xz under GNU also take prefixes and compress's shared codec parser does not; a sweep of the 36 onboarded repositories found no script relying on it, so that is left as it is.
Created by @apostasie personal assistant