From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH proxmox-apt 2/2] fix #4653: (In)Release file: improve handling of special suites
Date: Wed, 12 Apr 2023 09:17:58 +0200 [thread overview]
Message-ID: <20230412071758.3383292-2-f.gruenbichler@proxmox.com> (raw)
In-Reply-To: <20230412071758.3383292-1-f.gruenbichler@proxmox.com>
APT doesn't mind a repository with either "/" or "./" as suite/distribution,
such as
deb https://example.com/debian ./
in that case, the 'dists' part of the URL and the trailing slash (which would
be encoded as '_') is dropped in the file name in '/var/lib/apt/lists/'.
Other suite values with a trailing or leading '/' are rejected with an error by APT:
E: Malformed entry 1 in sources file /etc/apt/sources.list.d/test.list (absolute Suite Component)
E: The list of sources could not be read.
so this should be the only special case requiring handling.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
src/repositories/repository.rs | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/src/repositories/repository.rs b/src/repositories/repository.rs
index 7a19af4..ef77186 100644
--- a/src/repositories/repository.rs
+++ b/src/repositories/repository.rs
@@ -365,12 +365,18 @@ fn release_filename(uri: &str, suite: &str, detached: bool) -> PathBuf {
let encoded_uri = uri_to_filename(uri);
let filename = if detached { "Release" } else { "InRelease" };
- path.push(format!(
- "{}_dists_{}_{}",
- encoded_uri,
- suite.replace('/', "_"), // e.g. for buster/updates
- filename,
- ));
+ if suite == "/" {
+ path.push(format!("{encoded_uri}_{filename}"));
+ } else if suite == "./" {
+ path.push(format!("{encoded_uri}_._{filename}"));
+ } else {
+ path.push(format!(
+ "{}_dists_{}_{}",
+ encoded_uri,
+ suite.replace('/', "_"), // e.g. for buster/updates
+ filename,
+ ));
+ }
path
}
--
2.30.2
next prev parent reply other threads:[~2023-04-12 7:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-12 7:17 [pve-devel] [PATCH proxmox-apt 1/2] fallback to Release file for Origin retrieval Fabian Grünbichler
2023-04-12 7:17 ` Fabian Grünbichler [this message]
2023-06-06 16:25 ` [pve-devel] applied-series: " Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230412071758.3383292-2-f.gruenbichler@proxmox.com \
--to=f.gruenbichler@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.