* [PATCH proxmox-backup 0/5] client: report or fail on files left out for lack of permission
@ 2026-12-01 9:11 Dietmar Maurer
2026-12-01 9:11 ` [PATCH proxmox-backup 1/5] client: pxar: handle open errors at the call sites Dietmar Maurer
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Dietmar Maurer @ 2026-12-01 9:11 UTC (permalink / raw)
To: pbs-devel
A backup leaves out files and directories it cannot read for lack of
permission and only logs a warning, so the run still succeeds. The
graphical backup client needs to tell such a run apart from a
complete one: it reports it as incomplete, and it can fail it
instead. This series adds the hooks for that to the pxar archiver,
and a --fail-on-access-denied option to proxmox-backup-client for the
same reason.
Patch 1 moves the open error handling to the call sites; no
functional change is intended. Patch 2 makes the warning for an
unreadable .pxarexclude name its directory. Patches 3 and 4 add an
optional callback for entries left out for lack of permission, and an
option to fail the archive at the first one. Both are unset by
default, so existing callers behave as before. Patch 5 exposes the
fail option on the CLI.
An unreadable .pxarexclude is treated like an unreadable entry, even
when a pattern excludes it, because skipping its patterns can add
much more data than intended.
Dietmar Maurer (5):
client: pxar: handle open errors at the call sites
client: pxar: name the directory of an unreadable .pxarexclude
client: pxar: let callers see entries left out for lack of permission
client: pxar: optionally fail on entries left out for lack of
permission
client: backup: add option to fail on files that cannot be read
pbs-client/src/pxar/create.rs | 204 +++++++++++++-----
proxmox-backup-client/src/main.rs | 11 +
.../src/proxmox_restore_daemon/api.rs | 2 +
pxar-bin/src/main.rs | 2 +
4 files changed, 164 insertions(+), 55 deletions(-)
base-commit: 3e6b0575f0ed96ffedeab4becc9cb883d8f06ee1
--
2.47.3
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH proxmox-backup 1/5] client: pxar: handle open errors at the call sites
2026-12-01 9:11 [PATCH proxmox-backup 0/5] client: report or fail on files left out for lack of permission Dietmar Maurer
@ 2026-12-01 9:11 ` Dietmar Maurer
2026-12-01 9:11 ` [PATCH proxmox-backup 2/5] client: pxar: name the directory of an unreadable .pxarexclude Dietmar Maurer
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Dietmar Maurer @ 2026-12-01 9:11 UTC (permalink / raw)
To: pbs-devel
Opening an entry and opening a directory's .pxarexclude treat the same
errors differently, a missing .pxarexclude is no vanished file for
example, and open_file needed a flag to tell them apart. Handling the
errors where each is opened keeps such differences in place, and lets
a caller react to an error in its own way.
No functional change intended.
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
---
pbs-client/src/pxar/create.rs | 90 ++++++++++++++---------------------
1 file changed, 35 insertions(+), 55 deletions(-)
diff --git a/pbs-client/src/pxar/create.rs b/pbs-client/src/pxar/create.rs
index b1266b1fc..1d6e541ae 100644
--- a/pbs-client/src/pxar/create.rs
+++ b/pbs-client/src/pxar/create.rs
@@ -485,57 +485,31 @@ impl Archiver {
Ok(None)
}
- /// openat() wrapper which allows but logs `EACCES` and turns `ENOENT` into `None`.
- ///
- /// The `existed` flag is set when iterating through a directory to note that we know the file
- /// is supposed to exist and we should warn if it doesnt'.
- fn open_file(
- &mut self,
- parent: RawFd,
- file_name: &CStr,
- oflags: OFlag,
- existed: bool,
- ) -> Result<Option<OwnedFd>, Error> {
- // common flags we always want to use:
+ /// openat() wrapper which adds the common flags, and retries without `O_NOATIME` if that is
+ /// not permitted, for example for files owned by another user.
+ fn open_file(parent: RawFd, file_name: &CStr, oflags: OFlag) -> Result<OwnedFd, Errno> {
let oflags = oflags | OFlag::O_CLOEXEC | OFlag::O_NOCTTY;
- let mut noatime = OFlag::O_NOATIME;
- loop {
- return match proxmox_sys::fd::openat(
- &parent,
- file_name,
- oflags | noatime,
- Mode::empty(),
- ) {
- Ok(fd) => Ok(Some(fd)),
- Err(Errno::ENOENT) => {
- if existed {
- self.report_vanished_file();
- }
- Ok(None)
- }
- Err(Errno::EACCES) => {
- warn!("failed to open file: {:?}: access denied", file_name);
- Ok(None)
- }
- Err(Errno::ESTALE) => {
- self.report_stale_file_handle(None);
- Ok(None)
- }
- Err(Errno::EPERM) if !noatime.is_empty() => {
- // Retry without O_NOATIME:
- noatime = OFlag::empty();
- continue;
- }
- Err(other) => Err(Error::from(other)),
- };
+ match proxmox_sys::fd::openat(&parent, file_name, oflags | OFlag::O_NOATIME, Mode::empty())
+ {
+ Err(Errno::EPERM) => proxmox_sys::fd::openat(&parent, file_name, oflags, Mode::empty()),
+ result => result,
}
}
fn read_pxar_excludes(&mut self, parent: RawFd) -> Result<(), Error> {
- let fd = match self.open_file(parent, c".pxarexclude", OFlag::O_RDONLY, false)? {
- Some(fd) => fd,
- None => return Ok(()),
+ let fd = match Self::open_file(parent, c".pxarexclude", OFlag::O_RDONLY) {
+ Ok(fd) => fd,
+ Err(Errno::ENOENT) => return Ok(()),
+ Err(Errno::EACCES) => {
+ warn!("failed to open file: \".pxarexclude\": access denied");
+ return Ok(());
+ }
+ Err(Errno::ESTALE) => {
+ self.report_stale_file_handle(None);
+ return Ok(());
+ }
+ Err(err) => return Err(err.into()),
};
let old_pattern_count = self.patterns.len();
@@ -782,16 +756,22 @@ impl Archiver {
OFlag::O_PATH
};
- let fd = self.open_file(
- parent,
- c_file_name,
- open_mode | OFlag::O_RDONLY | OFlag::O_NOFOLLOW,
- true,
- )?;
-
- let fd = match fd {
- Some(fd) => fd,
- None => return Ok(()),
+ let oflags = open_mode | OFlag::O_RDONLY | OFlag::O_NOFOLLOW;
+ let fd = match Self::open_file(parent, c_file_name, oflags) {
+ Ok(fd) => fd,
+ Err(Errno::ENOENT) => {
+ self.report_vanished_file();
+ return Ok(());
+ }
+ Err(Errno::EACCES) => {
+ warn!("failed to open file: {c_file_name:?}: access denied");
+ return Ok(());
+ }
+ Err(Errno::ESTALE) => {
+ self.report_stale_file_handle(None);
+ return Ok(());
+ }
+ Err(err) => return Err(err.into()),
};
let metadata = match get_metadata(
--
2.47.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH proxmox-backup 2/5] client: pxar: name the directory of an unreadable .pxarexclude
2026-12-01 9:11 [PATCH proxmox-backup 0/5] client: report or fail on files left out for lack of permission Dietmar Maurer
2026-12-01 9:11 ` [PATCH proxmox-backup 1/5] client: pxar: handle open errors at the call sites Dietmar Maurer
@ 2026-12-01 9:11 ` Dietmar Maurer
2026-12-01 9:11 ` [PATCH proxmox-backup 3/5] client: pxar: let callers see entries left out for lack of permission Dietmar Maurer
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Dietmar Maurer @ 2026-12-01 9:11 UTC (permalink / raw)
To: pbs-devel
The warning only named the file itself, which leaves the user to guess
which of possibly many .pxarexclude files was not applied.
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
---
pbs-client/src/pxar/create.rs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/pbs-client/src/pxar/create.rs b/pbs-client/src/pxar/create.rs
index 1d6e541ae..e21d73f69 100644
--- a/pbs-client/src/pxar/create.rs
+++ b/pbs-client/src/pxar/create.rs
@@ -502,7 +502,8 @@ impl Archiver {
Ok(fd) => fd,
Err(Errno::ENOENT) => return Ok(()),
Err(Errno::EACCES) => {
- warn!("failed to open file: \".pxarexclude\": access denied");
+ let path = self.path.join(".pxarexclude");
+ warn!("failed to open file: {path:?}: access denied");
return Ok(());
}
Err(Errno::ESTALE) => {
--
2.47.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH proxmox-backup 3/5] client: pxar: let callers see entries left out for lack of permission
2026-12-01 9:11 [PATCH proxmox-backup 0/5] client: report or fail on files left out for lack of permission Dietmar Maurer
2026-12-01 9:11 ` [PATCH proxmox-backup 1/5] client: pxar: handle open errors at the call sites Dietmar Maurer
2026-12-01 9:11 ` [PATCH proxmox-backup 2/5] client: pxar: name the directory of an unreadable .pxarexclude Dietmar Maurer
@ 2026-12-01 9:11 ` Dietmar Maurer
2026-12-01 9:11 ` [PATCH proxmox-backup 4/5] client: pxar: optionally fail on " Dietmar Maurer
2026-12-01 9:11 ` [PATCH proxmox-backup 5/5] client: backup: add option to fail on files that cannot be read Dietmar Maurer
4 siblings, 0 replies; 6+ messages in thread
From: Dietmar Maurer @ 2026-12-01 9:11 UTC (permalink / raw)
To: pbs-devel
Entries that cannot be opened or stat'ed for lack of permission are
left out of the archive with a warning in the log, and the backup
succeeds. A caller that reports on a backup, such as a graphical
client showing its result, cannot tell such a run from a complete one
without parsing the log.
An optional callback now gets the archive-relative path of each entry
left out this way. The warnings stay as they were, and existing
callers pass no callback, so their behavior is unchanged.
An unreadable .pxarexclude is reported when its directory's patterns
are read, as they are not applied then, which can include much more
data than intended. It is not reported again when opened as an entry,
nor missed when a pattern excludes it as such.
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
---
pbs-client/src/pxar/create.rs | 90 +++++++++++++++++++
proxmox-backup-client/src/main.rs | 1 +
.../src/proxmox_restore_daemon/api.rs | 1 +
pxar-bin/src/main.rs | 1 +
4 files changed, 93 insertions(+)
diff --git a/pbs-client/src/pxar/create.rs b/pbs-client/src/pxar/create.rs
index e21d73f69..47ae4b01c 100644
--- a/pbs-client/src/pxar/create.rs
+++ b/pbs-client/src/pxar/create.rs
@@ -59,6 +59,9 @@ pub struct PxarCreateOptions {
pub previous_ref: Option<PxarPrevRef>,
/// Maximum number of lookahead cache entries
pub max_cache_size: Option<usize>,
+ /// Called with the archive-relative path of each entry left out for lack of permission. For
+ /// a `.pxarexclude` file, this also means that its patterns were not applied.
+ pub on_access_denied: Option<Box<dyn FnMut(&Path) + Send>>,
}
pub type MetadataArchiveReader = Arc<dyn ReadAt + Send + Sync + 'static>;
@@ -195,6 +198,7 @@ struct Archiver {
last_reusable_offset: Option<u64>,
reuse_stats: ReuseStats,
split_archive: bool,
+ on_access_denied: Option<Box<dyn FnMut(&Path) + Send>>,
}
type Encoder<'a, T> = pxar::encoder::aio::Encoder<'a, T>;
@@ -306,6 +310,7 @@ where
last_reusable_offset: None,
reuse_stats: ReuseStats::default(),
split_archive,
+ on_access_denied: options.on_access_denied,
};
archiver
@@ -504,6 +509,9 @@ impl Archiver {
Err(Errno::EACCES) => {
let path = self.path.join(".pxarexclude");
warn!("failed to open file: {path:?}: access denied");
+ // reported here rather than as an entry, as its patterns are not applied, also
+ // when a pattern excludes it as an entry
+ self.report_access_denied(Some(&path));
return Ok(());
}
Err(Errno::ESTALE) => {
@@ -688,6 +696,7 @@ impl Archiver {
Err(Errno::EACCES) => {
// may happen for fuse mountpoints without allow_other or allow_root
warn!("warning: failed to stat file: {full_path:?}: access denied");
+ self.report_access_denied(Some(&full_path));
continue;
}
Err(Errno::ESTALE) => {
@@ -724,6 +733,13 @@ impl Archiver {
warn!("warning: stale file handle encountered while reading: {path:?}");
}
+ fn report_access_denied(&mut self, path: Option<&PathBuf>) {
+ let path = path.unwrap_or(&self.path);
+ if let Some(callback) = self.on_access_denied.as_mut() {
+ callback(path);
+ }
+ }
+
fn report_vanished_file(&self) {
warn!("warning: file vanished while reading: {:?}", self.path);
}
@@ -766,6 +782,10 @@ impl Archiver {
}
Err(Errno::EACCES) => {
warn!("failed to open file: {c_file_name:?}: access denied");
+ // reported when its directory's patterns were read, which comes first
+ if c_file_name != c".pxarexclude" {
+ self.report_access_denied(None);
+ }
return Ok(());
}
Err(Errno::ESTALE) => {
@@ -1989,6 +2009,75 @@ mod tests {
Ok(testdir)
}
+ /// Archives `dir` and returns the entries reported as left out for lack of permission.
+ fn archive_access_denied(dir: &Path) -> Result<Vec<PathBuf>, Error> {
+ let denied: Arc<Mutex<Vec<PathBuf>>> = Arc::default();
+ let collect = Arc::clone(&denied);
+ let options = PxarCreateOptions {
+ entries_max: crate::pxar::ENCODER_MAX_ENTRIES,
+ on_access_denied: Some(Box::new(move |path| {
+ collect.lock().unwrap().push(path.to_path_buf())
+ })),
+ ..Default::default()
+ };
+ let source_dir = Dir::open(dir, OFlag::O_DIRECTORY, Mode::empty())?;
+ let writer = pxar::PxarVariant::Unified(DummyWriter::new::<PathBuf>(None)?);
+ let rt = tokio::runtime::Runtime::new()?;
+ rt.block_on(create_archive(
+ source_dir,
+ PxarWriters::new(writer, None),
+ Flags::DEFAULT,
+ |_| Ok(()),
+ options,
+ None,
+ None,
+ ))?;
+ let mut denied = std::mem::take(&mut *denied.lock().unwrap());
+ denied.sort();
+ Ok(denied)
+ }
+
+ #[test]
+ fn test_access_denied() -> Result<(), Error> {
+ use std::os::unix::fs::PermissionsExt;
+
+ if unsafe { libc::geteuid() } == 0 {
+ // skip test, root can read everything
+ return Ok(());
+ }
+
+ let testdir = create_testdir("test_access_denied")?;
+ std::fs::create_dir_all(testdir.join("locked"))?;
+ std::fs::create_dir_all(testdir.join("sub"))?;
+ std::fs::write(testdir.join("secret"), "data")?;
+ std::fs::write(testdir.join("sub/a.tmp"), "data")?;
+ std::fs::write(testdir.join("sub/.pxarexclude"), "*.tmp\n")?;
+ let chmod = |path: &str, mode| {
+ std::fs::set_permissions(testdir.join(path), std::fs::Permissions::from_mode(mode))
+ };
+ for path in ["locked", "secret", "sub/.pxarexclude"] {
+ chmod(path, 0o000)?;
+ }
+
+ let expected = [
+ PathBuf::from("locked"),
+ PathBuf::from("secret"),
+ PathBuf::from("sub/.pxarexclude"),
+ ];
+ // the unreadable .pxarexclude only once, though it is also opened as an entry
+ let reported = archive_access_denied(&testdir);
+ // also when a pattern excludes it as an entry
+ std::fs::write(testdir.join(".pxarexclude"), ".pxarexclude\n")?;
+ let excluded = archive_access_denied(&testdir);
+
+ for path in ["locked", "secret", "sub/.pxarexclude"] {
+ chmod(path, 0o755)?;
+ }
+ assert_eq!(reported?, expected);
+ assert_eq!(excluded?, expected);
+ Ok(())
+ }
+
#[test]
fn test_create_archive_with_reference() -> Result<(), Error> {
let euid = unsafe { libc::geteuid() };
@@ -2064,6 +2153,7 @@ mod tests {
last_reusable_offset: None,
reuse_stats: ReuseStats::default(),
split_archive: true,
+ on_access_denied: None,
};
let accessor = Accessor::new(pxar::PxarVariant::Unified(reader), metadata_size)
diff --git a/proxmox-backup-client/src/main.rs b/proxmox-backup-client/src/main.rs
index 5238a75ea..ef1b1575b 100644
--- a/proxmox-backup-client/src/main.rs
+++ b/proxmox-backup-client/src/main.rs
@@ -1242,6 +1242,7 @@ async fn create_backup(
skip_e2big_xattr,
previous_ref,
max_cache_size,
+ on_access_denied: None,
};
let upload_options = UploadOptions {
diff --git a/proxmox-restore-daemon/src/proxmox_restore_daemon/api.rs b/proxmox-restore-daemon/src/proxmox_restore_daemon/api.rs
index e6ea29093..aac46592b 100644
--- a/proxmox-restore-daemon/src/proxmox_restore_daemon/api.rs
+++ b/proxmox-restore-daemon/src/proxmox_restore_daemon/api.rs
@@ -370,6 +370,7 @@ fn extract(
skip_e2big_xattr: false,
previous_ref: None,
max_cache_size: None,
+ on_access_denied: None,
};
let pxar_writer = pxar::PxarVariant::Unified(TokioWriter::new(writer));
diff --git a/pxar-bin/src/main.rs b/pxar-bin/src/main.rs
index 4b14507ca..6511c1b17 100644
--- a/pxar-bin/src/main.rs
+++ b/pxar-bin/src/main.rs
@@ -383,6 +383,7 @@ async fn create_archive(
skip_e2big_xattr: false,
previous_ref: None,
max_cache_size: None,
+ on_access_denied: None,
};
let source = PathBuf::from(source);
--
2.47.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH proxmox-backup 4/5] client: pxar: optionally fail on entries left out for lack of permission
2026-12-01 9:11 [PATCH proxmox-backup 0/5] client: report or fail on files left out for lack of permission Dietmar Maurer
` (2 preceding siblings ...)
2026-12-01 9:11 ` [PATCH proxmox-backup 3/5] client: pxar: let callers see entries left out for lack of permission Dietmar Maurer
@ 2026-12-01 9:11 ` Dietmar Maurer
2026-12-01 9:11 ` [PATCH proxmox-backup 5/5] client: backup: add option to fail on files that cannot be read Dietmar Maurer
4 siblings, 0 replies; 6+ messages in thread
From: Dietmar Maurer @ 2026-12-01 9:11 UTC (permalink / raw)
To: pbs-devel
Leaving out entries that cannot be read lets a backup succeed while
it misses data, which retention may then use to replace complete
snapshots. A caller that needs all data, for example because it backs
up folders it expects to own, cannot rely on such a backup.
A new option fails the archive at the first such entry instead. This
includes a .pxarexclude that cannot be read, also one excluded as an
entry, as ignoring its patterns may add much more data than intended.
It is off by default, so existing callers keep leaving entries out.
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
---
pbs-client/src/pxar/create.rs | 39 +++++++++++++++----
proxmox-backup-client/src/main.rs | 1 +
.../src/proxmox_restore_daemon/api.rs | 1 +
pxar-bin/src/main.rs | 1 +
4 files changed, 34 insertions(+), 8 deletions(-)
diff --git a/pbs-client/src/pxar/create.rs b/pbs-client/src/pxar/create.rs
index 47ae4b01c..c6d4b8b41 100644
--- a/pbs-client/src/pxar/create.rs
+++ b/pbs-client/src/pxar/create.rs
@@ -62,6 +62,9 @@ pub struct PxarCreateOptions {
/// Called with the archive-relative path of each entry left out for lack of permission. For
/// a `.pxarexclude` file, this also means that its patterns were not applied.
pub on_access_denied: Option<Box<dyn FnMut(&Path) + Send>>,
+ /// Fail on the first entry that cannot be read for lack of permission, instead of leaving it
+ /// out
+ pub fail_on_access_denied: bool,
}
pub type MetadataArchiveReader = Arc<dyn ReadAt + Send + Sync + 'static>;
@@ -199,6 +202,7 @@ struct Archiver {
reuse_stats: ReuseStats,
split_archive: bool,
on_access_denied: Option<Box<dyn FnMut(&Path) + Send>>,
+ fail_on_access_denied: bool,
}
type Encoder<'a, T> = pxar::encoder::aio::Encoder<'a, T>;
@@ -311,6 +315,7 @@ where
reuse_stats: ReuseStats::default(),
split_archive,
on_access_denied: options.on_access_denied,
+ fail_on_access_denied: options.fail_on_access_denied,
};
archiver
@@ -511,7 +516,7 @@ impl Archiver {
warn!("failed to open file: {path:?}: access denied");
// reported here rather than as an entry, as its patterns are not applied, also
// when a pattern excludes it as an entry
- self.report_access_denied(Some(&path));
+ self.report_access_denied(Some(&path))?;
return Ok(());
}
Err(Errno::ESTALE) => {
@@ -696,7 +701,7 @@ impl Archiver {
Err(Errno::EACCES) => {
// may happen for fuse mountpoints without allow_other or allow_root
warn!("warning: failed to stat file: {full_path:?}: access denied");
- self.report_access_denied(Some(&full_path));
+ self.report_access_denied(Some(&full_path))?;
continue;
}
Err(Errno::ESTALE) => {
@@ -733,11 +738,15 @@ impl Archiver {
warn!("warning: stale file handle encountered while reading: {path:?}");
}
- fn report_access_denied(&mut self, path: Option<&PathBuf>) {
+ fn report_access_denied(&mut self, path: Option<&PathBuf>) -> Result<(), Error> {
let path = path.unwrap_or(&self.path);
if let Some(callback) = self.on_access_denied.as_mut() {
callback(path);
}
+ if self.fail_on_access_denied {
+ bail!("unable to back up {path:?}: access denied");
+ }
+ Ok(())
}
fn report_vanished_file(&self) {
@@ -784,7 +793,7 @@ impl Archiver {
warn!("failed to open file: {c_file_name:?}: access denied");
// reported when its directory's patterns were read, which comes first
if c_file_name != c".pxarexclude" {
- self.report_access_denied(None);
+ self.report_access_denied(None)?;
}
return Ok(());
}
@@ -2009,8 +2018,9 @@ mod tests {
Ok(testdir)
}
- /// Archives `dir` and returns the entries reported as left out for lack of permission.
- fn archive_access_denied(dir: &Path) -> Result<Vec<PathBuf>, Error> {
+ /// Archives `dir` and returns the entries reported as left out for lack of permission, or
+ /// with `fail`, fails at the first of them.
+ fn archive_access_denied(dir: &Path, fail: bool) -> Result<Vec<PathBuf>, Error> {
let denied: Arc<Mutex<Vec<PathBuf>>> = Arc::default();
let collect = Arc::clone(&denied);
let options = PxarCreateOptions {
@@ -2018,6 +2028,7 @@ mod tests {
on_access_denied: Some(Box::new(move |path| {
collect.lock().unwrap().push(path.to_path_buf())
})),
+ fail_on_access_denied: fail,
..Default::default()
};
let source_dir = Dir::open(dir, OFlag::O_DIRECTORY, Mode::empty())?;
@@ -2065,16 +2076,27 @@ mod tests {
PathBuf::from("sub/.pxarexclude"),
];
// the unreadable .pxarexclude only once, though it is also opened as an entry
- let reported = archive_access_denied(&testdir);
+ let reported = archive_access_denied(&testdir, false);
+ let failed = archive_access_denied(&testdir, true);
// also when a pattern excludes it as an entry
std::fs::write(testdir.join(".pxarexclude"), ".pxarexclude\n")?;
- let excluded = archive_access_denied(&testdir);
+ let excluded = archive_access_denied(&testdir, false);
+ std::fs::write(
+ testdir.join(".pxarexclude"),
+ "locked\nsecret\n.pxarexclude\n",
+ )?;
+ let excluded_failed = archive_access_denied(&testdir, true);
for path in ["locked", "secret", "sub/.pxarexclude"] {
chmod(path, 0o755)?;
}
assert_eq!(reported?, expected);
assert_eq!(excluded?, expected);
+ assert!(failed.is_err());
+ // only the .pxarexclude is left, which is excluded as an entry, but whose patterns would
+ // have been ignored
+ let err = format!("{:#}", excluded_failed.unwrap_err());
+ assert!(err.contains("sub/.pxarexclude"), "{err}");
Ok(())
}
@@ -2154,6 +2176,7 @@ mod tests {
reuse_stats: ReuseStats::default(),
split_archive: true,
on_access_denied: None,
+ fail_on_access_denied: false,
};
let accessor = Accessor::new(pxar::PxarVariant::Unified(reader), metadata_size)
diff --git a/proxmox-backup-client/src/main.rs b/proxmox-backup-client/src/main.rs
index ef1b1575b..e71677633 100644
--- a/proxmox-backup-client/src/main.rs
+++ b/proxmox-backup-client/src/main.rs
@@ -1243,6 +1243,7 @@ async fn create_backup(
previous_ref,
max_cache_size,
on_access_denied: None,
+ fail_on_access_denied: false,
};
let upload_options = UploadOptions {
diff --git a/proxmox-restore-daemon/src/proxmox_restore_daemon/api.rs b/proxmox-restore-daemon/src/proxmox_restore_daemon/api.rs
index aac46592b..c3ca6b807 100644
--- a/proxmox-restore-daemon/src/proxmox_restore_daemon/api.rs
+++ b/proxmox-restore-daemon/src/proxmox_restore_daemon/api.rs
@@ -371,6 +371,7 @@ fn extract(
previous_ref: None,
max_cache_size: None,
on_access_denied: None,
+ fail_on_access_denied: false,
};
let pxar_writer = pxar::PxarVariant::Unified(TokioWriter::new(writer));
diff --git a/pxar-bin/src/main.rs b/pxar-bin/src/main.rs
index 6511c1b17..05358fa52 100644
--- a/pxar-bin/src/main.rs
+++ b/pxar-bin/src/main.rs
@@ -384,6 +384,7 @@ async fn create_archive(
previous_ref: None,
max_cache_size: None,
on_access_denied: None,
+ fail_on_access_denied: false,
};
let source = PathBuf::from(source);
--
2.47.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH proxmox-backup 5/5] client: backup: add option to fail on files that cannot be read
2026-12-01 9:11 [PATCH proxmox-backup 0/5] client: report or fail on files left out for lack of permission Dietmar Maurer
` (3 preceding siblings ...)
2026-12-01 9:11 ` [PATCH proxmox-backup 4/5] client: pxar: optionally fail on " Dietmar Maurer
@ 2026-12-01 9:11 ` Dietmar Maurer
4 siblings, 0 replies; 6+ messages in thread
From: Dietmar Maurer @ 2026-12-01 9:11 UTC (permalink / raw)
To: pbs-devel
A backup leaves out files and directories it cannot read for lack of
permission, and only warns about them. Users who need complete
backups, for example of folders they expect to own entirely, can now
make it fail instead, so an incomplete snapshot never gets stored.
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
---
proxmox-backup-client/src/main.rs | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/proxmox-backup-client/src/main.rs b/proxmox-backup-client/src/main.rs
index e71677633..b4bc54d4e 100644
--- a/proxmox-backup-client/src/main.rs
+++ b/proxmox-backup-client/src/main.rs
@@ -788,6 +788,14 @@ fn spawn_catalog_upload(
optional: true,
default: false,
},
+ "fail-on-access-denied": {
+ type: Boolean,
+ description:
+ "Fail on files and directories that cannot be read for lack of permission, \
+ instead of leaving them out of the backup with a warning.",
+ optional: true,
+ default: false,
+ },
"no-cache": {
type: Boolean,
description: "Bypass local datastore cache for network storages.",
@@ -806,6 +814,7 @@ async fn create_backup(
change_detection_mode: Option<BackupDetectionMode>,
dry_run: bool,
skip_e2big_xattr: bool,
+ fail_on_access_denied: bool,
no_cache: bool,
limit: ClientRateLimitConfig,
_info: &ApiMethod,
@@ -1243,7 +1252,7 @@ async fn create_backup(
previous_ref,
max_cache_size,
on_access_denied: None,
- fail_on_access_denied: false,
+ fail_on_access_denied,
};
let upload_options = UploadOptions {
--
2.47.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-12-01 9:11 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01 9:11 [PATCH proxmox-backup 0/5] client: report or fail on files left out for lack of permission Dietmar Maurer
2026-12-01 9:11 ` [PATCH proxmox-backup 1/5] client: pxar: handle open errors at the call sites Dietmar Maurer
2026-12-01 9:11 ` [PATCH proxmox-backup 2/5] client: pxar: name the directory of an unreadable .pxarexclude Dietmar Maurer
2026-12-01 9:11 ` [PATCH proxmox-backup 3/5] client: pxar: let callers see entries left out for lack of permission Dietmar Maurer
2026-12-01 9:11 ` [PATCH proxmox-backup 4/5] client: pxar: optionally fail on " Dietmar Maurer
2026-12-01 9:11 ` [PATCH proxmox-backup 5/5] client: backup: add option to fail on files that cannot be read Dietmar Maurer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox