[pbs-devel] [PATCH proxmox-backup 3/3] pxar: only generate .pxarexclude-cli if there were CLI parameters
Wolfgang Bumiller
w.bumiller at proxmox.com
Thu Nov 12 11:22:51 CET 2020
series looks good to me, one thing though below:
On Thu, Nov 12, 2020 at 10:03:52AM +0100, Fabian Ebner wrote:
> previously a .pxarexclude entry in the root of the archive caused the file to
> be generated as well, because the patterns are read before calling
> generate_directory_file_list and within the function it wasn't possible to
> distinguish between a pattern coming from the CLI and a pattern coming from
> archive/root/.pxarexclude
>
> Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
> ---
> src/pxar/create.rs | 18 +++++++++---------
> 1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/src/pxar/create.rs b/src/pxar/create.rs
> index 1615a504..c907a8e0 100644
> --- a/src/pxar/create.rs
> +++ b/src/pxar/create.rs
> @@ -237,7 +237,15 @@ impl<'a, 'b> Archiver<'a, 'b> {
> let old_patterns_count = self.patterns.len();
Doesn't a similar issue still happen in encode_pxarexcludes_cli() since
we call it later below with `self.patterns` already extended by the
current `.pxarexclude` file? May have to pass `old_patterns_count` along
to it?
> self.read_pxar_excludes(dir.as_raw_fd())?;
>
> - let file_list = self.generate_directory_file_list(&mut dir, is_root)?;
> + let mut file_list = self.generate_directory_file_list(&mut dir, is_root)?;
> +
> + if is_root && old_patterns_count > 0 {
> + file_list.push(FileListEntry {
> + name: CString::new(".pxarexclude-cli").unwrap(),
> + path: PathBuf::new(),
> + stat: unsafe { std::mem::zeroed() },
> + });
> + }
>
> let dir_fd = dir.as_raw_fd();
>
> @@ -404,14 +412,6 @@ impl<'a, 'b> Archiver<'a, 'b> {
>
> let mut file_list = Vec::new();
>
> - if is_root && !self.patterns.is_empty() {
> - file_list.push(FileListEntry {
> - name: CString::new(".pxarexclude-cli").unwrap(),
> - path: PathBuf::new(),
> - stat: unsafe { std::mem::zeroed() },
> - });
> - }
> -
> for file in dir.iter() {
> let file = file?;
>
> --
> 2.20.1
More information about the pbs-devel
mailing list