From: Nicolas Frey <n.frey@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: Re: [PATCH proxmox-backup] fix #7382: correctly anchor nested paths for include/exclude patterns.
Date: Mon, 16 Mar 2026 13:58:22 +0100 [thread overview]
Message-ID: <83482468-bd18-4bd3-9e40-9e88b3a9fc0a@proxmox.com> (raw)
In-Reply-To: <20260316120459.35525-1-m.federanko@proxmox.com>
Hi, thanks for the patch! nit inline
On 3/16/26 1:04 PM, Manuel Federanko wrote:
> A pattern in a subdirectory would be built by just prepending the parent
> directory. This could break anchored patterns, which wouldn't match if
> the parent directory didn't start with a slash.
> Fixed this by explicitly checking if the base path starts with a slash
> and prepending it if it does not exist.
>
> It worked for anchored patterns in the root backup directory because
> here the pattern is "" + "/exclude".
>
> old:
> match_path = /level0/level1/exclude
> pattern = level0/level1/exclude
>
> new:
> match_path = /level0/level1/exclude
> pattern = /level0/level1/exclude
>
> Tested by creating a directory structure as described in the bug ticket
> and verifying the behavior.
>
nit: consider adding a Fixes trailer to reference the bug report, like so:
Fixes: https://bugzilla.proxmox.com/show_bug.cgi?id=7382
> Signed-off-by: Manuel Federanko <m.federanko@proxmox.com>
> ---
> pbs-client/src/pxar/create.rs | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/pbs-client/src/pxar/create.rs b/pbs-client/src/pxar/create.rs
> index 7f605a61..cec47749 100644
> --- a/pbs-client/src/pxar/create.rs
> +++ b/pbs-client/src/pxar/create.rs
> @@ -537,13 +537,20 @@ impl Archiver {
>
> let mut buf;
> let (line, mode, anchored) = if line[0] == b'/' {
> - buf = Vec::with_capacity(path_bytes.len() + 1 + line.len());
> + buf = Vec::with_capacity(path_bytes.len() + 2 + line.len());
> + // need to anchor the base path if it is not
> + if path_bytes.len() > 0 && path_bytes[0] != b'/' {
> + buf.push(b'/');
> + }
> buf.extend(path_bytes);
> buf.extend(line);
> (&buf[..], MatchType::Exclude, true)
> } else if line.starts_with(b"!/") {
> // inverted case with absolute path
> - buf = Vec::with_capacity(path_bytes.len() + line.len());
> + buf = Vec::with_capacity(path_bytes.len() + 1 + line.len());
> + if path_bytes.len() > 0 && path_bytes[0] != b'/' {
> + buf.push(b'/');
> + }
> buf.extend(path_bytes);
> buf.extend(&line[1..]); // without the '!'
> (&buf[..], MatchType::Include, true)
other than that, LGTM. Consider this:
Reviewed-by: Nicolas Frey <n.frey@proxmox.com>
prev parent reply other threads:[~2026-03-16 12:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-16 12:04 Manuel Federanko
2026-03-16 12:58 ` Nicolas Frey [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83482468-bd18-4bd3-9e40-9e88b3a9fc0a@proxmox.com \
--to=n.frey@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox