[pve-devel] applied: [PATCH proxmox] fix #5513: apt: do not assume that sources.list file exists

Fabian Grünbichler f.gruenbichler at proxmox.com
Thu Jun 6 11:08:10 CEST 2024


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 at 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 at lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 
> 
> 




More information about the pve-devel mailing list