[pbs-devel] [RFC proxmox-backup 1/4] datastore: always skip over base directory when listing index files

Fabian Grünbichler f.gruenbichler at proxmox.com
Thu Apr 17 11:29:21 CEST 2025


the commit subject could maybe indicate somehow that this is for the
GC-specific helper, and not some generic index listing code ;)

On April 16, 2025 4:18 pm, Christian Ebner wrote:
> The base is a directory and not an index file anyways, so there is no
> need to apply the filtering and archive type matching on it.
> Further, this will allow to use a hidden folder as base, otherwise
> not possible as excluded by the filtering, which will be useful when
> listing index files in a `.trash` folder.
> 
> No functional change intended.
> 
> Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
> ---
>  pbs-datastore/src/datastore.rs | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/pbs-datastore/src/datastore.rs b/pbs-datastore/src/datastore.rs
> index 309137e00..3fde8b871 100644
> --- a/pbs-datastore/src/datastore.rs
> +++ b/pbs-datastore/src/datastore.rs
> @@ -979,7 +979,9 @@ impl DataStore {
>  
>          use walkdir::WalkDir;
>  
> -        let walker = WalkDir::new(base).into_iter();
> +        let mut walker = WalkDir::new(base).into_iter();
> +        // always ignore the base directory itself, so a hidden folder can be used as base as well
> +        walker.next();

this should check for errors?

>  
>          // make sure we skip .chunks (and other hidden files to keep it simple)
>          fn is_hidden(entry: &walkdir::DirEntry) -> bool {
> -- 
> 2.39.5
> 
> 
> 
> _______________________________________________
> pbs-devel mailing list
> pbs-devel at lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
> 
> 
> 




More information about the pbs-devel mailing list