From: Wolfgang Bumiller <w.bumiller@proxmox.com>
To: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
Cc: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] applied: [PATCH proxmox-apt] release-file: improve invalid file-reference handling
Date: Fri, 5 Aug 2022 09:35:22 +0200 [thread overview]
Message-ID: <20220805073522.7fu7rosl5hbrtf54@wobu-vie.proxmox.com> (raw)
In-Reply-To: <20220804094350.3262432-1-f.gruenbichler@proxmox.com>
applied
On Thu, Aug 04, 2022 at 11:43:50AM +0200, Fabian Grünbichler wrote:
> if we encounter a file reference pointing to a component that is not
> contained in the componenents list, we can just ignore it as unknown.
> only treat parsing errors for references pointing to known components as
> actual errors.
>
> this currently triggers with (In)Release files for debian-updates and
> debian-security, which reference (empty) files for a "non-free-firmware"
> component that is not listed in the `Components` field of the release
> file.
>
> Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
> ---
> src/deb822/release_file.rs | 13 +++++++++----
> 1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/src/deb822/release_file.rs b/src/deb822/release_file.rs
> index ee805bb..6068238 100644
> --- a/src/deb822/release_file.rs
> +++ b/src/deb822/release_file.rs
> @@ -389,11 +389,16 @@ impl TryFrom<ReleaseFileRaw> for ReleaseFile {
> let (component, file_type) = components
> .iter()
> .find_map(|component| {
> - FileReferenceType::parse(component, &file)
> - .ok()
> - .map(|file_type| (component.clone(), file_type))
> + if !file.starts_with(&format!("{component}/")) {
> + return None;
> + }
> +
> + Some(
> + FileReferenceType::parse(component, &file)
> + .map(|file_type| (component.clone(), file_type)),
> + )
> })
> - .ok_or_else(|| format_err!("failed to parse file reference '{file}'"))?;
> + .unwrap_or_else(|| Ok(("UNKNOWN".to_string(), FileReferenceType::Unknown)))?;
>
> Ok((
> FileReference {
> --
> 2.30.2
prev parent reply other threads:[~2022-08-05 7:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-04 9:43 [pbs-devel] " Fabian Grünbichler
2022-08-05 7:35 ` Wolfgang Bumiller [this message]
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=20220805073522.7fu7rosl5hbrtf54@wobu-vie.proxmox.com \
--to=w.bumiller@proxmox.com \
--cc=f.gruenbichler@proxmox.com \
--cc=pbs-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox