pxar: extract: make invalid ACLs non-fatal

these can occur in practice, and neither setting nor getting them throws an
error. if "invalid" ACLs are non-restorable, this means that creating a pxar
archive with such an ACL is possible, but restoring it isn't.

reported in our community forum:
https://forum.proxmox.com/threads/155477

Tested-by: Gabriel Goller <g.goller@proxmox.com>
Acked-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler 2024-10-08 10:33:55 +02:00
parent 4e37c678dc
commit cbf7bbefb7

View File

@ -2,7 +2,7 @@ use std::ffi::{CStr, CString};
use std::os::unix::io::{AsRawFd, RawFd}; use std::os::unix::io::{AsRawFd, RawFd};
use std::path::Path; use std::path::Path;
use anyhow::{anyhow, bail, Context, Error}; use anyhow::{anyhow, Context, Error};
use nix::errno::Errno; use nix::errno::Errno;
use nix::fcntl::OFlag; use nix::fcntl::OFlag;
use nix::sys::stat::Mode; use nix::sys::stat::Mode;
@ -300,7 +300,7 @@ fn apply_acls(
} }
if !acl.is_valid() { if !acl.is_valid() {
bail!("Error while restoring ACL - ACL invalid"); log::warn!("Warning: {path_info:?} - ACL invalid, attempting restore anyway..");
} }
acl.set_file(c_proc_path, acl::ACL_TYPE_ACCESS)?; acl.set_file(c_proc_path, acl::ACL_TYPE_ACCESS)?;
@ -329,7 +329,7 @@ fn apply_acls(
} }
if !acl.is_valid() { if !acl.is_valid() {
bail!("Error while restoring ACL - ACL invalid"); log::warn!("Warning: {path_info:?} - ACL invalid, attempting restore anyway..");
} }
acl.set_file(c_proc_path, acl::ACL_TYPE_DEFAULT)?; acl.set_file(c_proc_path, acl::ACL_TYPE_DEFAULT)?;