Skip to content

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

@BenWiederhake

Description

@BenWiederhake
#[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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions