Bug 174690 - [ssh] cannot delete symbolic links on remote systems
Summary: [ssh] cannot delete symbolic links on remote systems
Status: RESOLVED FIXED
Alias: None
Product: Target Management
Classification: Tools
Component: RSE (show other bugs)
Version: 1.0.1   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 2.0.1   Edit
Assignee: Benjamin Muskalla CLA
QA Contact: Martin Oberhuber CLA
URL:
Whiteboard:
Keywords: bugday, contributed
Depends on:
Blocks:
 
Reported: 2007-02-19 16:00 EST by Martin Oberhuber CLA
Modified: 2011-05-25 09:39 EDT (History)
0 users

See Also:


Attachments
workaround (1.21 KB, patch)
2007-08-24 19:51 EDT, Benjamin Muskalla CLA
mober.at+eclipse: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Oberhuber CLA 2007-02-19 16:00:25 EST
On ssh connection to build.eclipse.org, have folder $HOME/ws2/eclipse, ls -l:

drwxr-xr-x  3 moberhuber common      176 2007-02-19 15:54 .
drwxr-xr-x  6 moberhuber common      336 2007-02-19 15:49 eclipse
lrwxrwxrwx  1 moberhuber common       61 2007-02-19 15:49 publish -> /home/data/httpd/download.eclipse.org/dsdp/tm/downloads/drops

In the RSE system view, select symbolic link "publish" and choose delete.
An error dialog is shown: "Operation failed. File system input or output error. Message reported from file system: Sftp: 2: No such file"
Comment 1 Benjamin Muskalla CLA 2007-08-24 19:51:37 EDT
Created attachment 76964 [details]
workaround

I think one of the problems with this is that SftpATTRS#isLink() always returns false (maybe also a known bug - never worked with Jsch until now).

As deleting a link simply works with the rm command, this should be also used for deleting links to directorys.

Attached is a patch which catches the exception mentioned above and tries to delete the resource which could be a link.
Comment 2 Martin Oberhuber CLA 2007-09-03 14:24:45 EDT
The patch and analysis helped fixing the issue, though I finally applied a different fix: calling ChannelSftp.lstat() instead of ChannelSftp.stat() returns the attributes of the link rather than the attributes of the item linked to, so this single-character-fix does the trick as well. There is no bug in Jsch, it was just user error :-)

Anyways, since your work helped fixing the issue I added your name to the list of contributors -- thanks for the patch!

Next time you submit a patch, you could make our work slightly easier if you could please

1. Add a line in the file header comment for your contribution, such that it is
   shipped with the patch. This time, I added the following for you:

 * Benjamin Muskalla (b.muskalla@gmx.net) - [174690][ssh] cannot delete symbolic links on remote systems

2. Add the disclaimer in the bugzilla comment as outlined here:
  
http://www.eclipse.org/dsdp/tm/development/committer_howto.php#external_contrib

Thanks!