Bug 504150 - If opened file gets deleted and re-created, prompt for deleted file doesn't automatically update
Summary: If opened file gets deleted and re-created, prompt for deleted file doesn't a...
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: general (other bugs)
Version First Reported In: 25.04.0
Platform: Manjaro Linux
: NOR minor
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-05-13 13:58 UTC by php4fan
Modified: 2025-06-01 16:17 UTC (History)
2 users (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 php4fan 2025-05-13 13:58:21 UTC
***
If you're not sure this is actually a bug, instead post about it at https://discuss.kde.org

If you're reporting a crash, attach a backtrace with debug symbols; see https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports

Please remove this comment after reading and before submitting - thanks!
***

SUMMARY


STEPS TO REPRODUCE
1.  open a file in Kate
2.  from outside of Kate, delete the file
>>> a prompt pops up as expected with the message "The file has been deleted or moved on disk" and the options "Close", "Save as...", "Ignore"
3. now from outside of kate, re-create the file at the same path with the same name, and put some contents in it

OBSERVED RESULT
Nothing happens. The "the file has been deleted..." prompt remains

EXPECTED RESULT
The prompt should change to "the file was modified on disk" with the options "enable autoreload", "view difference", "reload", "ignore" (BTW the normal popup for when the file is modified currently says "the file was CREATED" instead of saying "the file was MODIFIED", which accidentally would make sense in this particular situation [if the prompt did show up], but it's confusing in the general case)

SOFTWARE/OS VERSIONS
Operating System: Manjaro Linux 
KDE Plasma Version: 6.3.4
KDE Frameworks Version: 6.13.0
Qt Version: 6.9.0
Kernel Version: 6.6.88-1-MANJARO (64-bit)
Graphics Platform: Wayland
Processors: 12 × 12th Gen Intel® Core™ i7-1255U
Memory: 15.3 GiB of RAM
Graphics Processor: Intel® Iris® Xe Graphics
Manufacturer: ASUSTeK COMPUTER INC.
Product Name: Vivobook_ASUSLaptop X1502ZA_F1502ZA
System Version: 1.0
ADDITIONAL INFORMATION
Comment 1 Christoph Cullmann 2025-05-19 20:20:58 UTC
I think as soon as the file is gone we loose the file watcher for it, but I might be wrong.
Comment 2 John Kizer 2025-05-25 23:21:25 UTC
I can reproduce on Kate 25.04.1 - although just to note, the prompt does update if you try to save using the deleted prompt, then decline to potentially overwrite data on disk when warned (the dialog with the "Save Nevertheless" option).

Thanks!
Comment 3 Christoph Cullmann 2025-05-30 19:03:22 UTC
If somebody has interest to fix that, that is welcome, not sure how to do best, guess one would need to watch the directory, too.
Comment 4 Christoph Cullmann 2025-06-01 16:16:52 UTC
Git commit 6f74166359e2724ec05d2b100e31f9d5dfd218fb by Christoph Cullmann.
Committed on 01/06/2025 at 16:16.
Pushed by cullmann into branch 'master'.

trigger refresh of modified on disk message if the type did change

e.g. for

touch test
kate test
rm test
touch test

M  +3    -1    src/document/katedocument.cpp

https://invent.kde.org/frameworks/ktexteditor/-/commit/6f74166359e2724ec05d2b100e31f9d5dfd218fb
Comment 5 Christoph Cullmann 2025-06-01 16:17:16 UTC
Was easier than thought to fix, just a bit too much guarding.