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

Christian Ebner c.ebner at proxmox.com
Thu Apr 17 12:27:12 CEST 2025


On 4/17/25 11:29, Fabian Grünbichler wrote:
> 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?

Agreed, makes sense as otherwise the index file listing might return 
without error and an empty list if e.g. the directory cannot be read for 
some reason.

Will adapt accordingly, thanks!





More information about the pbs-devel mailing list