Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mv: shouldn't panic when xattr application fails #6727

Open
BenWiederhake opened this issue Sep 23, 2024 · 0 comments
Open

mv: shouldn't panic when xattr application fails #6727

BenWiederhake opened this issue Sep 23, 2024 · 0 comments
Labels

Comments

@BenWiederhake
Copy link
Collaborator

#[cfg(all(unix, not(any(target_os = "macos", target_os = "redox"))))]
fsxattr::apply_xattrs(to, xattrs).unwrap();

https://github.com/uutils/coreutils/blob/main/src/uu/mv/src/mv.rs#L676-L677

This code panics when "moving" (copying) a file to a different filesystem, and applying the extended attrs fails. This can happen for many reasons:

  • TOCTOU races (e.g. file was moved/deleted)
  • destination filesystem doesn't support xattrs
  • user doesn't have permissions to set xattrs

mv should not panic in those cases. Instead, it should probably output some form of warning message and continue moving the other files, or whatever GNU mv does.

Discovered while reviewing #6632 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant