SCP Error !

Dec 20, 2014 at 4:56 PM
Hello there,
Sometimes when i am trying to upload file i am getting the following error:

SCP Error set times: operation not permited      
The code i am using is just a simple upload command from one file to some place...

Searching on the internet found that this could be something is trying to set the file date on the server after upload ..... Maybe this helps you to find the error !

It happens sometimes not always so i cannot reproduce it !
To resolve the problem i am just catching the exception and not show it !
Dec 20, 2014 at 4:57 PM
Maybe it has to do with this

I do not know Just suggesting ...
Dec 22, 2014 at 2:48 PM
The issue you referred to has nothing to do with the problem that you're reporting.

I've can only reproduce the "set times" issue when the remote file already exists, and the user with which you're doing the upload is not the owner of that file.
Can you verify if that may be the cause ?
Dec 22, 2014 at 2:56 PM
I will contact the user that reported the issue to me and come back to you !
Dec 22, 2014 at 9:08 PM
Finally i have the info you need from me !

Yes you are correct reporting that the problem occurs when the file i am uploading exists already ! In my case the owner of the file is the user that uploads the file and it has read or write permissions to the file ! The group of the file also is the group that the user belongs ! And the group and other has read permissions also !
Since the owner has read/write should be enough to set the date/time info. I wonder also if it is a security issue and not bug since the issue occurs after the file upload
is completed successfully !

I report that if the file is not existing the error message is not appearing !

In my application if i have access to ssh shell i perform an deletion of the file first and then i upload it !So every time is like an first time ! If there was a delete sub in the scp class i would call it first and then i would use the upload so the issue would not appear. Some implementation i have does not have shell access so the only way is the upload and cannot do rm....

So i propose three solutions for you;
  1. It would help if you implement an delete sub in the scp class since shell access is not always accessible in order to use the command line deletion !
  2. You can add an deletefirst parameter in the upload function so that if the user sets it to true it would delete the file first and then upload...
  3. All above !
Dec 22, 2014 at 9:08 PM
If you need anything else please tell me !
Dec 22, 2014 at 9:37 PM
Well it my code i did as i said above....

If i have SSH access i perform an linux command line deletion and after i you the scp upload ! In all other cases the issue still exists ...
Dec 23, 2014 at 9:54 AM
Can you provide the full stack trace ?

As a workaround, we could add an option that allows you to control whether the original timestamp of the file should be preserved.
This would apply to both download and upload.
If you're interested in having this, then please submit a feature request (issue of type 'Feature') for it.
Note that I won't start working on this immediately. I first want to get a new stable out there.
Dec 23, 2014 at 11:08 AM
Since i have implemented a workaround actually i have overcome this issue ! So the issue is not occurring anymore ! But during the Xmas holidays i will find sometime to reproduce it and have a full stuck trace !

As far as the solution you are suggesting yes may be it 's a workaround somehow but it would help actually if there was a way to remove a file through the scp class ....