public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: [pve-devel] applied: [PATCH proxmox] fix #5513: apt: do not assume that sources.list file exists
Date: Thu, 06 Jun 2024 11:08:10 +0200	[thread overview]
Message-ID: <1717664883.doyowm88dy.astroid@yuna.none> (raw)
In-Reply-To: <20240605082924.60327-1-f.ebner@proxmox.com>

thanks!

On June 5, 2024 10:29 am, Fiona Ebner wrote:
> Some users might want to switch to using only the newer .sources files
> already, which Debian is going to switch to in the long run.
> 
> Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
> ---
>  proxmox-apt/src/repositories/mod.rs | 21 +++++++++++++++------
>  1 file changed, 15 insertions(+), 6 deletions(-)
> 
> diff --git a/proxmox-apt/src/repositories/mod.rs b/proxmox-apt/src/repositories/mod.rs
> index 7bfe9cae..26e4192c 100644
> --- a/proxmox-apt/src/repositories/mod.rs
> +++ b/proxmox-apt/src/repositories/mod.rs
> @@ -146,12 +146,21 @@ pub fn repositories() -> Result<Repositories, Error> {
>  
>      let sources_list_d_path = PathBuf::from(APT_SOURCES_LIST_DIRECTORY);
>  
> -    match APTRepositoryFile::new(sources_list_path) {
> -        Ok(Some(mut file)) => match file.parse() {
> -            Ok(()) => files.push(file),
> -            Err(err) => errors.push(err),
> -        },
> -        _ => bail!("internal error with '{}'", APT_SOURCES_LIST_FILENAME),
> +    if sources_list_path.exists() {
> +        if sources_list_path.is_file() {
> +            match APTRepositoryFile::new(sources_list_path) {
> +                Ok(Some(mut file)) => match file.parse() {
> +                    Ok(()) => files.push(file),
> +                    Err(err) => errors.push(err),
> +                },
> +                _ => bail!("internal error with '{}'", APT_SOURCES_LIST_FILENAME),
> +            }
> +        } else {
> +            errors.push(APTRepositoryFileError {
> +                path: APT_SOURCES_LIST_FILENAME.to_string(),
> +                error: "not a regular file!".to_string(),
> +            });
> +        }
>      }
>  
>      if !sources_list_d_path.exists() {
> -- 
> 2.39.2
> 
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 
> 
> 


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


      reply	other threads:[~2024-06-06  9:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-05  8:29 [pve-devel] " Fiona Ebner
2024-06-06  9:08 ` Fabian Grünbichler [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=1717664883.doyowm88dy.astroid@yuna.none \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal