Skip to content

Commit

Permalink
log: warn when ignoring extended attributes error
Browse files Browse the repository at this point in the history
  • Loading branch information
nardoor committed Aug 5, 2024
1 parent 66c1aed commit 80c99d4
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions crates/core/src/backend/ignore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use chrono::TimeZone;
use chrono::{DateTime, Local, Utc};
use derive_setters::Setters;
use ignore::{overrides::OverrideBuilder, DirEntry, Walk, WalkBuilder};
use log::{debug, warn};
use log::warn;
#[cfg(not(windows))]
use nix::unistd::{Gid, Group, Uid, User};

Expand Down Expand Up @@ -488,7 +488,7 @@ fn list_extended_attributes(path: &Path) -> RusticResult<Vec<ExtendedAttribute>>
/// * [`IgnoreErrorKind::ErrorXattr`] - if Xattr couldn't be listed or couldn't be read
#[cfg(all(not(windows), not(target_os = "openbsd")))]
fn list_extended_attributes(path: &Path) -> RusticResult<Vec<ExtendedAttribute>> {
Ok(xattr::list(path)
xattr::list(path)
.map_err(|err| IgnoreErrorKind::ErrorXattr {
path: path.to_path_buf(),
source: err,
Expand All @@ -504,7 +504,7 @@ fn list_extended_attributes(path: &Path) -> RusticResult<Vec<ExtendedAttribute>>
.unwrap(),
})
})
.collect::<RusticResult<Vec<ExtendedAttribute>>>()?)
.collect::<RusticResult<Vec<ExtendedAttribute>>>()
}

/// Maps a [`DirEntry`] to a [`ReadSourceEntry`].
Expand Down Expand Up @@ -568,14 +568,7 @@ fn map_entry(

let extended_attributes = match list_extended_attributes(entry.path()) {
Err(e) => {
// TODO - discuss this log:
// Most probably that if Xattr read failure happens for one file,
// it will also happen for every file in the same subdirectory.
//
// The end result would be a real flood of errors.
// For this reason, I propose to have this log at "debug" level
// so it's not transparent, but doesn't impact a "lambda" use case of rustic.
debug!("ignoring error: {e}\n");
warn!("ignoring error: {e}\n");
vec![]
}
Ok(xattr_list) => xattr_list,
Expand Down

0 comments on commit 80c99d4

Please sign in to comment.