Editing (and saving) a database on a different OS causes all line breaks in notes to be changed
Closed this issue · 8 comments
Summary
When editing a database from different OSes, notably Linux and Windows, it appears as if all line endings of notes are changed to the OS default. It would be nice if this was standardizes to reduce the amount of changes from saves across
Context
Using https://github.com/Narigo/keepass-diff/, I added a custom git diff tool for a keepass database so that I can view diffs for individual or multiple commits. This generally works very well, but I noticed that whenever someone edited the database on Windows after someone edited it on Linux (and vice versa), I would see basically all notes shown as changed without any visible changes to the contents of the fields.
My best guess currently is that it has to be changes to invisible white space characters and from the described procedure, different line break characters should be most likely. Unfortunately, keepass-diff does not provide clarity about the presence of CR characters.
The integration I use in particular has been documented at Narigo/keepass-diff#33 (comment). Only the --verbose
argument is required to understand the full extent of this issue. Credentials for the databases can be provided using a method of your choosing.
If such a change is out of scope for this project, I will move it to a feature request for keepass-diff to ignore line ending changes in its reports instead.
Is it ALL notes or just ones from entries that have been changed?
All notes. The entry I changed didn't even have a note.
Hmmm this could be a Qt induced artifact. It is also something that happens all the time without any consequences. I would just keep pressing on keediff to ignore end of line marker differences unless a flag is passed to explicitly care. Basically this looks like convert all \r\n to \n then do the comparison.
I have created Narigo/keepass-diff#56 to track this for keepass-diff. I should also note that the edits happening on Windows are generally done with upstream KeePass but the CRLF line endings are still changed to just LF for all entries when I edit such a file on Linux using keepassxc.
Why not use keepassxc on windows as well? That is also a very important detail.
I'll ask my colleague to also edit and save with keepassxc once. You're right, it may be that keepassxc always saves with just LF in which case it'd just be a disagreement on the format between keepassxc and keepass.
KeepassXC on Windows saves the file with LF line endings (and keepass-diff doesn't report any extra changes for it), so this isn't a problem caused by keepassxc after all.
As for whether keepassxc should adhere to what mainline KeePass does for storing notes in using CRLF or whether KeePass itself should switch to the generally more neutral "just LF" convention, I don't know. I would definitely say that keepassxc is closer to being correct here than keepass itself, but keepass also wasn't developed with cross-platform compatibility in mind iirc.
Feel free to close this issue if you don't want to derive any actions for keepassxc from it.
I attached the file that was edited using keepassxc on windows: whitespacetest_2_windows_keepassxc.zip
The original file can be found in whitespacetest.zip.
We won't be making any changes here 😄