Bug 388186 - Kate fails to reload files from disk as they disappear/reappear (and other cases)
Summary: Kate fails to reload files from disk as they disappear/reappear (and other ca...
Status: RESOLVED FIXED
Alias: None
Product: frameworks-ktexteditor
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.90.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-12-24 01:13 UTC by nfxjfg
Modified: 2022-01-22 19:01 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.91
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description nfxjfg 2017-12-24 01:13:09 UTC
I have this reproducible with 2 git branches, where one branch adds a new file:
- checkout the other branch (which lacks the new file)
- confirm reloading (will show an empty editor window when you select the file)
- checkout the first branch again
- the file is not reloaded, and still shows an empty editor window, even though the file definitely has content on disk

Using "Reload All" gives you the file back.

I think this also happened when the file was not empty. Then it contained an old version of the file, different from the on disk version. This is even more evil, but I can't reproduce it. But I had some embarrassing bugs due to editing a file during a rebase, and accidentally restoring some old edits (can't tell if the file was removed and recreated at some point during all the reloading).

This probably happened in slightly older kate versions too (before #387358 happened), but not in even older versions. Sorry, I don't know at which versions this was, and have no easy way to test.

Kate 17.08.3, Project Plugin enabled.
Comment 1 Justin Zobel 2020-10-27 04:23:05 UTC
Can you please confirm if this happens on a more recent version of Kate. I haven't been able to reproduce this issue.
Comment 2 nfxjfg 2020-10-29 13:45:50 UTC
Reproduces with kate 20.08.2, Kate Part 5.74.0.

Here's a potentially better reproduction:

First make sure the project plugin is enabled. Enable "Warn about files being modified by foreign processes" in the kate general options.

Step 1, run this in bash:

mkdir /tmp/gittest
cd /tmp/gittest
git init .
echo "a" > foo1.txt
echo "b" > foo2.txt
git add foo*
git commit -m "c1"
git checkout -b branch2
echo "c" > foo3.txt
echo "d" > foo4.txt
git add foo*
git commit -m "c2"

Step 2: open foo1.txt in bash. The "Projects" tab will now list the files foo1.txt to foo4.txt.

Step 3: open all files. Click on foo1.txt to foo4.txt in the "Projects" file list. They will show what was written to them by the shell commands.

Step 4: run "git checkout master" in the shell. Kate will tell you that foo3.txt and foo4.txt will be deleted. Click "Reload".

Step 5: confirm file contents and click foo4.txt down to foo1.txt in the "Projects" file list. foo4.txt and foo3.txt are empty.

Step 6: run "git checkout branch2". You will notice that kate neither notifies nor reload anything. If you click on foo3.txt and foo4.txt, they are still shown as empty. You can do "File->Reload All", and the expected file contents fill show up properly.

I've tested this with the kate version mentioned above. For my private use, I'm using a hacked kate version from 2017, which does not have this problem.
Comment 3 nfxjfg 2020-10-29 13:46:34 UTC
PS: let me know at which step the results of my reproduction differs from yours.
Comment 4 Christoph Feck 2020-11-09 23:34:30 UTC
Requested information was added with comment 2; changing status for inspection.
Comment 5 Justin Zobel 2020-11-13 06:10:39 UTC
Can now confirm this with the steps provided in Comment 2
Comment 6 Waqar Ahmed 2022-01-22 19:01:34 UTC
Fixed in 5.91