Conversation
slice_to_extension parses bz3 and PRETTY_SUPPORTED_EXTENSIONS advertises it, but the suggestion walk consults SUPPORTED_EXTENSIONS, so it did not recognise the extension and proposed out.bz3.tar.gz, which ouch itself rejects for a misplaced archive format.
dc7b847 to
c853973
Compare
|
Rebased onto current On the new base: |
| if parsed.compression_formats == [CompressionFormat::Tar] { | ||
| continue; | ||
| } |
There was a problem hiding this comment.
Hi, why are we skipping tar here?
There was a problem hiding this comment.
Nothing, and you are right to ask. tar is itself in SUPPORTED_EXTENSIONS, so that guard was skipping a case that already passed the assertion. It was dead weight and it narrowed the test for no reason.
Removed in 23ff69e. The loop now covers tar as well, so dropping it from the list fails too:
'tar' is advertised and parsable but missing from SUPPORTED_EXTENSIONS
Before the change, that mutation passed. bz3 is still caught, which was the original point. Sorry for the slow reply on this one.
The loop skipped any extension whose only compression format is Tar, but tar is itself listed in SUPPORTED_EXTENSIONS, so the guard skipped a case that already passed. Removing it means dropping "tar" from the list now fails the test too, where before only "bz3" and friends were covered.
What's broken
bz3is missing fromSUPPORTED_EXTENSIONS, althoughslice_to_extensionparses it andPRETTY_SUPPORTED_EXTENSIONSadvertises it. The "insert an archive format" hint walks that list, so it does not see thebz3boundary and suggests a path ouch then refuses.Repro
Following the old hint verbatim:
So the hint pointed at a path ouch rejects on its own terms.
The fix
One entry added to
SUPPORTED_EXTENSIONS.Verification
Two tests. One pins the suggestion for
linux.bz3andlinux.bz3.gz. The other walks every extension inPRETTY_SUPPORTED_EXTENSIONS, skips the archive-first ones, and asserts the rest are inSUPPORTED_EXTENSIONS, so a future addition cannot go missing the same way. Removingbz3again fails both, the second with the name of the offending extension.Output above is from binaries built before and after, not from the unit tests.
Full suite passes.
cargo fmt --checkandcargo clippy --all-targets -- -D warningsclean. I built withbzip3off, sincelibbzip3-sysdoes not compile here (missingstddef.h); that only affects whether the resulting archive can be written, not the extension bookkeeping this changes.tbz2andtbz3are parsable but absent fromSUPPORTED_ALIASES. They are archive-first, so the suggestion path never consults them, and I left them alone to keep this to one concern.