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

Saving a file removes Extended Attributes of that file #619

Open
Self-Layer opened this issue Dec 29, 2023 · 0 comments
Open

Saving a file removes Extended Attributes of that file #619

Self-Layer opened this issue Dec 29, 2023 · 0 comments

Comments

@Self-Layer
Copy link

Self-Layer commented Dec 29, 2023

 * Xed version 3.4.3
 * Distribution - Linux Mint 21.2

xattr Extended Attributes of a file are lost after saving in XED with option "Create Backup-Copy" active

Steps to reproduce
Create a text file
Add some extended attributes to that file with "xattr" or "Eiciel"
Open that file in Xed
Change the file
Save the file

Expected behaviour
Xed should not change the extended attributes of any file

Other information
If one looks at the inode-number (with "ls -i") of the original file, the backup-copy and the saved file (with the original name)
then it shows that the backup-copy is the original file that has been renamed, that means it has the extended attributes!
The saved file on the other hand is a new file, that contains the changed file content, but has no extended attributes of the original file.

The solution is therefore, that Xed copies the extended attributes to all files that are no longer the original file (meaning the inode-number has changed).

An easy way to do this is to use "cp"

  • cp --archive --attributes-only ORIGINALFILE NEWFILE (creates an empty file, with the same name and all the same attributes as the original file)
  • cp --archive ORIGINALFILE NEWFILE (creates a copy of the original file [content, name and all attributes the same])

Thank you for all your work on Xed & all the best for you in 2024!

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

No branches or pull requests

1 participant