Topic "Blank file being created"

Author Message
Mazrim5
[View user's profile]

Joined: 2010-02-03
Posts: 3
Location: Pittsburgh, PA
Hello,

I have recently downloaded WinSCP version 4.2.5 to try it out doing an SFTP, and I'm having a strange issue. The target of my file (which is a server I have no access to) has a process running that immediately grabs the file when I upload it and renames it with a different name. However, when my SFTP upload is done, they have the full file and have renamed it to a new name, but there is also another file in the directory with the same name as the file I was just sending with size 0 bytes. This file is not owned by my user and I cannot overwrite it, so I can't send my file again after that until they remove that zero byte file.

For example, my file is "A.txt". Once I finish uploading "A.txt", the server side picks up "A.txt" and renames it to "A123.txt". So a directory listing should just show "A123.txt". But along with "A123.txt" (which is the exact same size as my local file), there is also a zero byte "A.txt" file.

Originally I thought it might have something to do with setting the permissions. I thought that, since the SSH_FXP_SETSTAT command is being sent after the SSH_FXP_CLOSE command, that maybe the server was creating a new, blank file to set the attributes on if the process on the server was grabbing it before the SSH_FXP_SETSTAT command got to the server. However, I turned off all permission changes (and the log file now reflects that no SSH_FXP_SETSTAT command is being sent) and I'm still getting the blank file.

Also, I am limited with my login to one particular filename ("A.txt" for this example). If I try to upload a file with a different name, the server should prevent me. And it does, sort of. If I try to send "B.txt", I get a permission denied error, but I still get a zero byte "B.txt" file on the server.

I should point out that, if I use VShell (from VanDyke software) or Robo-FTP to send this file, I do not have this problem. The server is a Tumbleweed server, version 4.7.

Does anyone have any clues at all as to what would cause this issue?
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
I've never seen the problem before. Though I would try turning off Transfer to temporary filename option.
_________________
Martin Prikryl
Mazrim5
[View user's profile]

Joined: 2010-02-03
Posts: 3
Location: Pittsburgh, PA
My current settings are to use the temporary filename only if it's above 100 KBs, but my file is only 13 KBs, so it wouldn't be doing that anyway. Besides, as I said, the server will only let me put one filename and that's it. So it would not let me put a temporary filename and rename it.

According to the company that owns the server, they had another customer that had this same issue with WinSCP. That customer ultimately gave up and used another product. I'm a little more stubborn than that =)

Considering that this happens if I try to send a filename that I'm not allowed to (I get permission denied but still get a zero-byte file of that name on the server), I believe it has to do with the SSH_FXP_OPEN command. If I'm reading the code correctly, I see that the SSH_FXF_CREAT and SSH_FXF_WRITE are both sent with the open. And maybe SSH_FXF_TRUNC, although without digging through the code more I can't be sure. Does the SSH_FXF_WRITE need to be sent with the SSH_FXF_CREAT? Could it be possible that the server is not properly handling that? I wanted to compile the code myself and play around with that, but unfortunately I don't have Borland C++ so I can't get it compiled.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
Mazrim5 wrote:
Considering that this happens if I try to send a filename that I'm not allowed to (I get permission denied but still get a zero-byte file of that name on the server), I believe it has to do with the SSH_FXP_OPEN command. If I'm reading the code correctly, I see that the SSH_FXF_CREAT and SSH_FXF_WRITE are both sent with the open. And maybe SSH_FXF_TRUNC, although without digging through the code more I can't be sure. Does the SSH_FXF_WRITE need to be sent with the SSH_FXF_CREAT? Could it be possible that the server is not properly handling that? I wanted to compile the code myself and play around with that, but unfortunately I don't have Borland C++ so I can't get it compiled.

I believe the flag SSH_FXF_WRITE has to be specified, otherwise you are not allowed to write to the file after it is created.
_________________
Martin Prikryl
Mazrim5
[View user's profile]

Joined: 2010-02-03
Posts: 3
Location: Pittsburgh, PA
prikryl wrote:
I believe the flag SSH_FXF_WRITE has to be specified, otherwise you are not allowed to write to the file after it is created.


Is there any way to get someone to make me a version of WinSCP that allows me to choose what flags (CREAT, WRITE, TRUNC, etc.) are sent to the server when I upload a file? =)
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License