Hexchat is overwriting read-only configs
Hexchat seems to been overwriting hexchat.conf and servlist.conf (and maybe other config files). For users that manage their configuration files inside a dotfiles or a project like Home-Manager, where you generally symlink the files to another place, it is impossible to keep those files in sync, because once Hexchat is started the symlink is deleted and replaced with the real file. Even setting hexchat.conf file to 400 permission (read-only), the file is still deleted and replaced with a file with the original permissions.
Ideally Hexchat should not overwrite those files and respect their permissions, so if it can't write the configuration file it fails without changing the file (but maybe it should log this somewhere).
Related issue: https://github.com/nix-community/home-manager/pull/1805
So looking at the save_config function: https://github.com/hexchat/hexchat/blob/7a275812c0002fe10db5c60e29a34ba6ce4cede1/src/common/cfgfiles.c#L1003-L1064
It seems that it generates a new config file with a .new prefix, and after serializing the configuration options it renames the .new file to the old place. This seems a fine approach (i.e. probably more robust than overwrite), but it would be better to have some checks if the file is read-only or something.
Another work around for now, if you use unix/linux os you can use chattr +i <file> to make file read-only and chattr -i <file> to make it writable again. But any changes you make while file is read-only wont apply after using chattr command.
@thiagokokada since you now seem to understand that mechanism - pls close this issue.
Another work around for now, if you use unix/linux os you can use
chattr +i <file>to make file read-only andchattr -i <file>to make it writable again. But any changes you make while file is read-only wont apply after usingchattrcommand.
Yeah, this works, but like you said it is just a workaround. Ideally hexchat shouldn't overwrite files marked as read-only for the user.
@thiagokokada since you now seem to understand that mechanism - pls close this issue.
No since there is no solution, only a workaround.
patches are welcome