[pbs-devel] [PATH proxmox-backup] fix #4380: stat() is run when file is executed

Fiona Ebner f.ebner at proxmox.com
Fri Aug 4 10:20:44 CEST 2023


Am 04.08.23 um 09:54 schrieb Gabriel Goller:
> On 8/4/23 09:42, Fiona Ebner wrote:
> 
>> Am 03.08.23 um 17:22 schrieb Gabriel Goller:
>>> diff --git a/pbs-client/src/pxar/create.rs
>>> b/pbs-client/src/pxar/create.rs
>>> index 2577cf98..c573c2a3 100644
>>> --- a/pbs-client/src/pxar/create.rs
>>> +++ b/pbs-client/src/pxar/create.rs
>>> @@ -434,6 +434,15 @@ impl Archiver {
>>>               assert_single_path_component(os_file_name)?;
>>>               let full_path = self.path.join(os_file_name);
>>>   +            let match_path =
>>> PathBuf::from("/").join(full_path.clone());
>>> +            if self
>>> +                .patterns
>>> +                .matches(match_path.as_os_str().as_bytes(), None)
>> Is it fine to call matches() without the file mode in all cases? Can't
>> it make a difference for directory matching? If it's okay, please
>> explain why in the commit message.
> 
> I think so, because we get the `patterns` (at least those with
> MatchType::Exclude) only from the `.pxarexclude` file or from the
> command line argument `--exclude`. Both do not allow to specify the file
> mode.
> 

But the MatchFlag::MATCH_DIRECTORIES flag is set for the pattern with a
trailing slash in match_list.rs's parse_pattern_do() in the pathpatterns
create during construction. My concern is that now a file 'foo' will
match the pattern 'foo/' when it previously didn't (but I didn't test it).





More information about the pbs-devel mailing list