Bug 488641 - Incorrect warning when saving file modified on disk under a new name
Summary: Incorrect warning when saving file modified on disk under a new name
Status: REPORTED
Alias: None
Product: kate
Classification: Applications
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-06-17 22:01 UTC by cwo
Modified: 2025-09-01 18:30 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description cwo 2024-06-17 22:01:12 UTC
SUMMARY

When a file is modified on disk while it is open in Kate, one of the ways to mitigate data loss is to save the old version under a new name using the "Save As..." function (File > Save as, or CTRL-SHIFT-S). However, Kate displays a misleading warning if the user tries to do this.

STEPS TO REPRODUCE
1.  (assuming no directory test exists) mkdir test; cd test; touch test1; kate test1
2.  echo 1 >> test 1
3.  A banner pops up in kate, informing the user that the file was modified on disk.
4. File > Save As, choose test2 as the new name.

OBSERVED RESULT

A warning dialog opens: 

"Possible data loss – Kate

The file /home/<username>/test/test2 was modified on disk.

Do you really want to save this file? Both your open file and the file on disk were changed. There could be some data lost."

The first part is a straight up untruth - ~/test/test2 was not modified on disk; it doesn't even exist yet.

The second part is confusing. At first, I thought it was an untruth as well, but it is true - if the modified file was saved under a different name and the user made modifications as well, the original version of the first file would be lost. (But Kate allows undo even after saving, so at least as far back as the undo stack goes, the data can still be recovered after saving).

EXPECTED RESULT

The most important is that Kate does not lie about the new file I'm saving to being modified on disk. This is very confusing.

As more of a wishlist item, the second part of the message should be rewritten to make it clearer what is actually going on, and what happens if the user saves. 

One option would be a message similar to 

"The original file .../test1 was modified on disk by another program. 

If you save now, the version you edited and the modifications made by the external program are both safe. You will lose access to the original, unmodified version of the file".

Obviously, the phrasing could be improved and tightened

Alternatively, get rid of the message and trust that the user knows the original version would be lost. I think that's how most editors do "Save as" in these circumstances; but having Kate be extra clear about potential data loss is not a bad idea as long as it's clear what data are lost.

SOFTWARE/OS VERSIONS

This happens on both Kubuntu 24.04 with Kate 23.08.05 and current Neon Developer with Kate 24.07.70.
Comment 1 Bill Goodman 2025-09-01 18:30:08 UTC
Version 25.08.0 has different but still incorrect behavior.

1) Open "test.txt" in Kate.
2) Modify "test.txt" with another program.
3) Kate displays message:
   The file 'test.txt' was modified on disk
   There are several option buttons including "Ignore".
4) Click IGNORE button.
5) In Kate, use Save As command to save file as "test_alt.txt".
6) Kate displays message:
   The file "test_alt.txt" was modified on disk.
   Do you really want to save this unmodified file? You could overwrite changed data in the file on disk.

The first statement that "test_alt.txt" was modified is not correct since the file does not exist.
The second statement about an unmodified file makes no sense.
The third statement regarding overwriting changed data on disk is also incorrect since the data is being written to a new file.