Gedit removes extended file attributes for no reason

I am gathering experience with extended file attributes. The goal is to save some meta-data for/with text files.

During this process I detected a strange behaviour by Gedit. When Gedit opens and resaves a file with extended file attributes, they disappear. This behaviour was already discussed, e.g. here:
https://askubuntu.com/questions/663883/gedit-not-preserving-extended-attributes-on-file-edit
https://superuser.com/questions/960300/how-to-preserve-the-extended-file-attributes-in-linux

What is even more strange, if a file with attributes previously removed by Gedit is opened and resaved by another program (e.g. LibreOffice Writer), then, sometimes they appear again! However this effect is unpredictable.

Could someone explain what is going on here?

There is a relevant bug with some more info: https://gitlab.gnome.org/GNOME/glib/-/issues/434.

1 Like

Thank you, Ondrej! The link has been useful.

A short summary of the problem: By resaving a file, Gedit creates a new one with a different inode. By doing so, the program “forgets” to copy extended attributes.

However this is an issue neither with Gedit nor with GtkSourceView, but rather with an underlying (GIO?) function used for replacing the original file. Other applications that use this function in the same manner are also affected (e.g. xed from Linux Mint).

After 9 years the bug is still marked as open…

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.