Repository navigation
Imports: resolve a leading ./ in an apt index entry's Filename, as apt does - #846
Merged
Merged
Conversation
Indexes made with `dpkg-scanpackages ./pool` or `apt-ftparchive packages ./pool` list `Filename: ./pool/...`, which `files::validate_path` refuses, so an import of such a repository failed every package. The parser now drops a Filename's `.` segments (resolve_filename), so the check, the download and the item's stored Filename all see the resolved path; `..`, empty segments and a leading `/` stay and are still refused. Fixes #754 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012e6DJaER1FpBfS1RFru5JP
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.
Fixes #754
Problem
Repositories made with
dpkg-scanpackages ./poolorapt-ftparchive packages ./poollistFilename: ./pool/main/h/hello/hello_1.0_amd64.deb.Entry::problemchecks that path withfiles::validate_path, which refuses a.segment, so an import of such a repository failed every package with "is no path below the repository".Change
crates/formats/apt/src/import.rs: newresolve_filenamedrops aFilename's.segments.read_packagesapplies it when it reads the field, so the resolved path is the only one anEntrycarries:Entry::problemchecks it, the download URL is built from it, and the import item stores it. A.., an empty segment and a leading/stay in the path, andvalidate_pathstill refuses them.a_filename_is_resolved_as_apt_resolves_it:./and inner.segments are resolved, and./../x.deb,pool/./../x.deb,/./pool/x.deband./are still refused.crates/server/tests/apt_import.rs: the static-repository test'sfinepackage is now listed as./pool/.... It is imported and downloaded once frompool/.... Without the fix this test fails: the dry run plans 4 packages instead of 5.docs/changes/2.2.0/754.fixed.md.Tests
cargo test -p forge-format-apt: 49 passedcargo test -p forge-server --test apt_import(PostgreSQL via testcontainers through mirror.gcr.io): 3 passedcargo test -p forge-server --lib import: 17 passedcargo clippy -p forge-format-apt -p forge-server --all-targets -- -D warnings,cargo fmt --all -- --checkandcargo xtask changelog --check: all cleanGenerated by Claude Code