jun7 / rox-filer

ROX file manager
24 stars 6 forks source link

Copying doesn't preserve some xattrs for files #215

Closed JakeSFR closed 4 years ago

JakeSFR commented 4 years ago

Hey Jun,

We (in the Fatdog Team) have noticed that ROX doesn't copy all of extended attributes in case of files. To repro (on ext4 fs):

# touch z
# setfattr -n user.label -v abc z
# setfattr -n security.label -v 123 z

Now, copying/duplicating that file using ROX preserves only the "user" namespace, the "security" one is lost. It concerns only files, not directories. Moving also works fine.

We came up with a couple of solutions:

  1. Adding G_FILE_COPY_ALL_METADATA flag to:

https://github.com/jun7/rox-filer/blob/f3f4bb38f563546d3be20ba46f932c40c4d614c0/ROX-Filer/src/action.c#L1678-L1682

  1. Adding xattr_copy(path, dest_path); between lchown() and send_check_path():

https://github.com/jun7/rox-filer/blob/f3f4bb38f563546d3be20ba46f932c40c4d614c0/ROX-Filer/src/action.c#L1689-L1692

What do you think?

jun7 commented 4 years ago

Thank you for reporting!

I preferred the adding G_FILE_COPY_ALL_METADATA

JakeSFR commented 4 years ago

Thanks!