Bug 368145 - Target file content not changed when saving another file as that file to replace it.
Summary: Target file content not changed when saving another file as that file to repl...
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: application (show other bugs)
Version: 16.08
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-02 09:57 UTC by CnZhx
Modified: 2017-07-29 11:28 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description CnZhx 2016-09-02 09:57:54 UTC
There are two files in a folder. Edit one file using Kate then save it as to replace the other one. The content of the other file should be changed as the content of the first one but it is not.

Reproducible: Always

Steps to Reproduce:
1. open Kate,
2. create a new file with content "file1" and then save using file name "file1",
and keep this file opened
3. create a new file in a new tab with content "file2" and then save using file
name "file2", and keep this file opened, too
4. save current session then close Kate
5. open Kate and reload previous session
6. change the content in "file2" from "file2" to "file2 replace file1"
7. save a copy of "file2" and select to replace/override "file1" and confirm
override for the warnings
8. check the content of "file1"

Actual Results:  
Content of "file1" remains to be the original after the replacing operation.

Expected Results:  
Content of "file1" is expected to be the content of modified "file2".

This problem is found to be with Kate 16.04 but still exists in Kate 16.08 when checked after openSUSE Tumbleweed upgrade yesterday.
Comment 1 Dominik Haumann 2016-09-03 08:35:21 UTC
It seems this is by design, that is: If you open in the Menu: Settings > Configure Kate > General, and then "[x] Warn about files modified by foreign processes", then you'll get a warning everytime the file is changed. Can you confirm?
Comment 2 CnZhx 2016-09-03 09:43:43 UTC
Hi Dominik,

I confirm that this option has been enabled. When I open "file2" then choose "save a copy as .." to override "file1", Kate warns about the overwrite but does not warn about change made to "file1". Actually, the problem is not the warning message but the content of "file1" (the targe file that was overwritten with the content from "file2") is NOT changed.

Should we expect the target file content to be changed to the content of the file used to overwrite to the target file?
Comment 3 CnZhx 2016-10-26 20:51:50 UTC
This problem still exists in 16.08.2.

There would be no error if using "Save As..." instead of "Save Copy As..." from "File" in the menu bar.
Comment 4 Christoph Cullmann 2017-07-24 09:59:22 UTC
Git commit db714d744fba689673a02d85dfbe168e8fbd4e2d by Christoph Cullmann.
Committed on 24/07/2017 at 09:53.
Pushed by cullmann into branch 'master'.

fix save as copy, it missed to allow overwriting the destination file
we check if we want that via a dialog, but we still always fail to do so

M  +2    -2    src/document/katedocument.cpp

https://commits.kde.org/ktexteditor/db714d744fba689673a02d85dfbe168e8fbd4e2d
Comment 5 CnZhx 2017-07-29 11:28:11 UTC
(In reply to Christoph Cullmann from comment #4)
Thanks Christoph for this fix. Hopefully this will enter the repository soon.