Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 297381

Summary: Copy of file via RemoteToolsFileStore broken
Product: [Tools] PTP Reporter: Emmanuel Geay <egeay>
Component: Remote ToolsAssignee: Greg Watson <g.watson>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: beth, egeay, g.watson
Version: 3.0   
Target Milestone: 3.0.1   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on:    
Bug Blocks: 300889    

Description Emmanuel Geay CLA 2009-12-09 13:51:28 EST
Hi,

Remote copy of file seems to experience a race condition issue.
If I run the next test case:

final IResourceManagerControl rmControl = (IResourceManagerControl) resourceManager;
    final IResourceManagerConfiguration rmc = rmControl.getConfiguration();
    final IRemoteServices rmServices = PTPRemoteCorePlugin.getDefault().getRemoteServices(rmc.getRemoteServicesId());
    final IRemoteConnection rmConnection = rmServices.getConnectionManager().getConnection(rmc.getConnectionName());
    final IRemoteFileManager fileManager = rmServices.getFileManager(rmConnection);
    
    final IFileSystem fileSystem = EFS.getLocalFileSystem();
    final IFileStore logFileStore = fileSystem.getStore(new Path("C:/log.txt"));
    logFileStore.copy(fileManager.getResource("/tmp").getChild("log.txt"), EFS.NONE, new NullProgressMonitor());

It fails for me with the following exception:

org.eclipse.core.runtime.CoreException: Failed to set permission of remote file /tmp/log.txt (No such file)
	at org.eclipse.ptp.remote.remotetools.core.RemoteToolsFileStore.putInfo(RemoteToolsFileStore.java:398)
	at org.eclipse.core.filesystem.provider.FileStore.transferAttributes(FileStore.java:489)
	at org.eclipse.core.filesystem.provider.FileStore.copyFile(FileStore.java:220)
	at org.eclipse.core.filesystem.provider.FileStore.copy(FileStore.java:140)
	at org.eclipse.core.internal.filesystem.local.LocalFile.copy(LocalFile.java:110)
	...
Caused by: org.eclipse.ptp.remotetools.exception.RemoteOperationException: Failed to set permission of remote file /tmp/log.txt (No such file)
	at org.eclipse.ptp.remotetools.internal.ssh.RemoteItem.commitAttributes(RemoteItem.java:75)
	at org.eclipse.ptp.remote.remotetools.core.RemoteToolsFileStore.putInfo(RemoteToolsFileStore.java:396)
	... 56 more
Caused by: 2: No such file
	at com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2289)
	at com.jcraft.jsch.ChannelSftp._stat(ChannelSftp.java:1741)
	at com.jcraft.jsch.ChannelSftp._stat(ChannelSftp.java:1758)
	at com.jcraft.jsch.ChannelSftp.chmod(ChannelSftp.java:1604)
	at org.eclipse.ptp.remotetools.internal.ssh.RemoteItem.commitAttributes(RemoteItem.java:72)
	... 57 more


If I change the version of org.eclipse.ptp.remotetools.internal.ssh.FileTools to the previous revision (ie 1.9), it works again.

Thanks,

Emmanuel.
Comment 1 Beth Tibbitts CLA 2010-01-05 14:32:56 EST
this is manifesting itself  in an X10DT remote C++ backend scenario
Comment 2 Beth Tibbitts CLA 2010-01-18 15:42:38 EST
I've checked in the fix which is the previous version of FileTools. This fixes our problem that manifests itself in X10DT.
Comment 3 Beth Tibbitts CLA 2010-01-18 17:05:34 EST
Note that I checked this into the PTP_3_0 branch. I don't know what the status of HEAD is.  Does it need it too?
Comment 4 Emmanuel Geay CLA 2010-01-21 17:24:57 EST
Yes, it's needed too in HEAD... Or providing a different fix of course.
Comment 5 Greg Watson CLA 2010-01-21 17:38:33 EST
This is about to be superseded by a patch that hopefully fixes a range of remote tools issues. Go ahead and apply anyway if you want though.
Comment 6 Greg Watson CLA 2010-04-08 17:48:21 EDT
This should now be fixed in head. Please test and report any problems.
Comment 7 Greg Watson CLA 2010-05-15 21:09:10 EDT
This should now be fixed. Please reopen if the problem persists.