Edit does not download modified files but only opens local caches

Advertisement

ac
Joined:
Posts:
15

Edit does not download modified files but only opens local caches

Hi,

I've just noticed that, by trying editing a file on the server (Right Click > Edit), when the file is modified on the server, and one clicks again on Edit, the file is not downloaded anymore, but only the local cache (in the temp folder) is open.

I'm using an external editor (Notepad++) and can confirm that the local temporary file remains unchanged (to exclude a bug of Notepad++). By flushing the cache (or hitting F5), when WinSCP detects a new timestamp on the remote file, by clicking on Edit, the remote file is correctly downloaded and opened.

I've also tried to disable all the caches described here (https://winscp.net/eng/docs/directory_cache), but nothing has changed.

Step to reproduce
  1. Create a remote file
  2. Open it by Right Click > Edit
  3. Modify the remote file
  4. Right Click > Edit
  5. The local file is not downloaded; thus, the external editor does not show the changes.
Expected behaviour
The expected behaviour has WinSCP constantly downloading the remote file on edit, regardless the file is cached locally or not.

Thank you for the support
Adriano C.

Description: The Edit operation

bug.png

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,263
Location:
Prague, Czechia

Re: Edit does not download modified files but only opens local caches

I cannot reproduce the problem. Please post session log file showing the two "edit" actions. And give us times you triggered both actions.

Reply with quote

ac
Joined:
Posts:
15

Hi,

Today I downloaded WinSCP 5.21, and I confirm the issue is still present.

I have reasons to believe that the problem is that WinSCP does not update the local timestamp in the temporary folder so it does not allow the external editor (Notepad++ in my case) to realise that the file has changed:

2022-09-21 12:21:58.135 Preserving timestamp [2022-09-21T10:21:53.000Z]

Session debug log and step to reproduce
I've recorded a session inside a log file (attached to this message) where:
- I logged in to a remote Linux server
- Tried Right Click / Edit the "/root/winscp.txt" file previously created. Notepad++ showed the expected contents. The following are the file details on the server:
-rw-r--r-- 1 root root 41 Sep 21 10:21 winscp.txt
- Modified the winscp.txt file on the server. The file size and timestap on the server have changed as expected:
-rw-r--r-- 1 root root 2025 Sep 21 10:23 winscp.txt
- I've added the following log separator to let you easily identify the lines before and after the external modification:
*********************************************************************
**
**** Here the file /root/winscp.txt has been modified on the server!!
**
*********************************************************************
- Tried Right Click / Edit the "/root/winscp.txt" file again. This time Notepad++ has not detected any change.
- Note. The timestamp of the file inside %Temp%/scpXXX/root/winscp.txt has not changed.


As you can imagine, this bug is really troublesome when dealing with a remote server because it's impossible to figure out why something isn't working as expected. The point is that one is not watching the actual file contents!

Thank you in advance for your support,
Adriano C.
  • winscp-session-debug.log (158.92 KB, Private file)
Description: Session debug log file.

Reply with quote

martin
Site Admin
martin avatar

OK, I assume you did not refresh the file panel between the two edits, right? Would the problem go away, if you do refresh it?

Reply with quote

ac
Joined:
Posts:
15

Good morning Martin,

Not this time, but the first time I faced the problem, having supposed a caching issue, I'm certain I've tried "Commands"/ "Clear Cache" multiple times with no results.

In fact, WinSCP does understand that something is changed remotely and actually transfers the new file locally.

As far as I can tell, the only problem relies on the fact that the timestamp is not updated so the external editors don't refresh the contents/offer to refresh it.

Thanks,
Adriano C.

Reply with quote

Advertisement

ac
Joined:
Posts:
15

Apologies Martin, what do you mean specifically with refreshing the panel? Pressing F5 on the WinSCP windows to force a refresh?

Thanks,
Adriano

Reply with quote

ac
Joined:
Posts:
15

Hi Martin,

Just tested and I confirm that nothing changes even after a panel refresh (either by pressing F5 or CTRL+R).

Thanks,
Adriano C.

Reply with quote

Advertisement

ac
Joined:
Posts:
15

Hi Martin,

I've logged a new session. By forcing the panel refresh, Notepad++ gets correctly notified of the file changes and everything works as expected.

However, I still believe this is a bug because, when I click on Edit, the remote file is technically downloaded locally. In fact, if I manually check the contents into the temporary folder (in my specific case, %Temp%\scp30942\root\winscp.txt), the local file actually contains the latest remote server contents.

But, because the timestamp is preserved, the external editor doesn't reload it. So, from the user perspective, the perceived outcome is that the remote server has not changed.

Thanks,
Adriano
  • root@167.235.133.61.log (157.62 KB, Private file)
Description: Session log

Reply with quote

martin
Site Admin
martin avatar

I see that the behavior is not ideal. I'm going to improve it. I just wanted to make sure I understand the problem. Because your original claims did not match my understanding of what WinSCP is doing.

I'll contact you on your email address, once I have anything to test.

Reply with quote

Advertisement

Advertisement

ac
Joined:
Posts:
15

Hi Martin,

I've just tested the private binary and the bug has been fixed.

Many thanks for that!

Kind regards,
Adriano C.

Reply with quote

ac
Joined:
Posts:
15

Hi Martin,

Is there any chance that the bugfix to this might be backported to 5.x release, please? Unfortunately, it makes it very inconvenient to edit remote server configuration files.

Thanks,
Adriano C.

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum