You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Nicolas Delsaux <ni...@gmail.com> on 2010/09/15 10:51:15 UTC

[VFS][SFTP] Unable to navigate to directory

Hi all
following my previous question, I have a new issue regarding
navigation to a SFTP directory.
I connect to a remote SFTP server by first creating a FileObject
linked to its root folder, then I try to open a subdirectory by
calling resolveFile, but it seems to fail "in the middle". Here is the
code :

			FileObject root = fsManager.resolveFile("sftp:username:password@server/");
			FileObject target =
root.resolveFile("appli/myappli/data/files/ged_bur%250"));

			return target.getChildren().length>0;

I initially used target.exists(), but as it did not seems to work, I
tried to check for directory content, but it also fails.
Notice that when I ssh "by hand" to this server (with same username
and password), I can without any trouble navigate to this directory.
I done further exploration and notice that writing, in my debug
console the following succeeded

root.getChild("appli").getChild("myappli").getChild("data")

while the following failed

root.getChild("appli").getChild("myappli").getChild("data").getChild("files")

with this exception

org.apache.commons.vfs.FileSystemException: Could not list the
contents of "sftp://root:perigee@quasar/appli/perigee_63D/data"
because it is not a folder.
	at org.apache.commons.vfs.provider.AbstractFileObject.getChildren(AbstractFileObject.java:527)
	at org.apache.commons.vfs.provider.AbstractFileObject.getChild(AbstractFileObject.java:634)
	at com.perigee.svnsync.SftpExecutor.existsContent(SftpExecutor.java:166)
	at com.perigee.svnsync.SvnSynchronizer.examineRelease(SvnSynchronizer.java:32)
	at com.perigee.svnsync.SvnSynchronizer.synchronize(SvnSynchronizer.java:86)
	at com.perigee.svnsync.Main.run(Main.java:125)
	at com.perigee.svnsync.Main.main(Main.java:110)


Unfortunatly, a ls indicates that

total 1
drwxr-xr-x  3 root root  72 Jan 25  2010 .
drwxr-xr-x 20 root root 880 Sep  6 09:30 ..
drwxr-xr-x  5 root root 128 Mar 31 18:11 files

yes, as I expected, files is a directory.

Notice that I can also do all those SSH operations using, as an
example, WinSCP. Which leads me to think that this may not be a
server-side issue, but rather a problem with my use of commons VFS.

So, have you got any suggestions regarding this particular issue ?
Thanks

-- 
Nicolas Delsaux

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: [VFS][SFTP] Unable to navigate to directory

Posted by James Carman <ja...@carmanconsulting.com>.
I committed a patch a while ago in the FTP provider to have it support
symbolic links better:

https://issues.apache.org/jira/browse/VFS-196

Perhaps we need to do that with SFTP too?

On Wed, Sep 15, 2010 at 11:52 AM, Ralph Goers
<ra...@dslextreme.com> wrote:
> So the data "directory" is a link to another mount.  I'm not familiar with the SFTP code but my guess is there is something preventing it from following links.
>
> Ralph
>
> On Sep 15, 2010, at 7:45 AM, Nicolas Delsaux wrote:
>
>> On Wed, Sep 15, 2010 at 4:11 PM, Ralph Goers <ra...@dslextreme.com> wrote:
>>>
>>> What does ls show when in myappli?
>>>
>>
>> server:/appli/myappli # ls -la
>> total 25041454
>> drwxr-xr-x 12 root root            576 Sep 15 16:17 .
>> drwxr-xr-x 28 root perigee        1632 Aug  3 11:03 ..
>> lrwxrwxrwx  1 root root             18 Jan 23  2010 data -> /mnt/md0/data_63d/
>>
>> Damn, maybe this prevents navigation, no ?
>>
>> --
>> Nicolas Delsaux
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>> For additional commands, e-mail: user-help@commons.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: [VFS][SFTP] Unable to navigate to directory

Posted by Nicolas Delsaux <ni...@gmail.com>.
On Wed, Sep 15, 2010 at 5:52 PM, Ralph Goers <ra...@dslextreme.com> wrote:
> So the data "directory" is a link to another mount.  I'm not familiar with the SFTP code but my guess is there is something preventing it from following links.
>
I'm making the assumption the link is not followed by commons VFS, as
debugging indicates that "data" has FileType.FILE where I guess
FileType.DIRECTORY would be needed for getChildren() and the such to
work, no ?

Unfortunatly, when trying to read symlink content (using
getFileContent().getInputStream()), all i get is

org.apache.commons.vfs.FileSystemException: Could not read file
"sftp://root:perigee@quasar/appli/perigee_63D/data".
	at org.apache.commons.vfs.provider.AbstractFileObject.getInputStream(AbstractFileObject.java:1123)
	at org.apache.commons.vfs.provider.DefaultFileContent.getInputStream(DefaultFileContent.java:317)

Caused by: 4: Failure
	at com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2289)
	at com.jcraft.jsch.ChannelSftp._get(ChannelSftp.java:929)
	at com.jcraft.jsch.ChannelSftp.get(ChannelSftp.java:870)
	at com.jcraft.jsch.ChannelSftp.get(ChannelSftp.java:849)
	at org.apache.commons.vfs.provider.sftp.SftpFileObject.doGetInputStream(SftpFileObject.java:384)
	at org.apache.commons.vfs.provider.AbstractFileObject.getInputStream(AbstractFileObject.java:1119)
	... 7 more

However, the symlink targets to that folder

quasar:/appli/perigee_63D # ls -la /mnt/md0/
total 8144379
drwxr-xr-x 20 root     root           880 Sep  6 09:30 .
drwxr-xr-x  8 root     root           256 Jun 24 10:22 ..
drwxr-xr-x  3 root     root            72 Jan 25  2010
data_destination <-- YES, This one !

Which i should be able to navigate, no ?

-- 
Nicolas Delsaux

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: [VFS][SFTP] Unable to navigate to directory

Posted by Ralph Goers <ra...@dslextreme.com>.
So the data "directory" is a link to another mount.  I'm not familiar with the SFTP code but my guess is there is something preventing it from following links.

Ralph

On Sep 15, 2010, at 7:45 AM, Nicolas Delsaux wrote:

> On Wed, Sep 15, 2010 at 4:11 PM, Ralph Goers <ra...@dslextreme.com> wrote:
>> 
>> What does ls show when in myappli?
>> 
> 
> server:/appli/myappli # ls -la
> total 25041454
> drwxr-xr-x 12 root root            576 Sep 15 16:17 .
> drwxr-xr-x 28 root perigee        1632 Aug  3 11:03 ..
> lrwxrwxrwx  1 root root             18 Jan 23  2010 data -> /mnt/md0/data_63d/
> 
> Damn, maybe this prevents navigation, no ?
> 
> --
> Nicolas Delsaux
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: [VFS][SFTP] Unable to navigate to directory

Posted by Nicolas Delsaux <ni...@gmail.com>.
On Wed, Sep 15, 2010 at 4:11 PM, Ralph Goers <ra...@dslextreme.com> wrote:
>
> What does ls show when in myappli?
>

server:/appli/myappli # ls -la
total 25041454
drwxr-xr-x 12 root root            576 Sep 15 16:17 .
drwxr-xr-x 28 root perigee        1632 Aug  3 11:03 ..
lrwxrwxrwx  1 root root             18 Jan 23  2010 data -> /mnt/md0/data_63d/

Damn, maybe this prevents navigation, no ?

--
Nicolas Delsaux

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: [VFS][SFTP] Unable to navigate to directory

Posted by Ralph Goers <ra...@dslextreme.com>.
What does ls show when in myappli?

On Sep 15, 2010, at 4:53 AM, Nicolas Delsaux wrote:

> On Wed, Sep 15, 2010 at 12:52 PM, sebb <se...@gmail.com> wrote:
>> 
>> So 'data' is not a folder.
>> 
> 
> Well ... it is, because
>>> 
>>> 
>>> Unfortunatly, a ls indicates that
>>> 
>>> total 1
>>> drwxr-xr-x  3 root root  72 Jan 25  2010 .
>>> drwxr-xr-x 20 root root 880 Sep  6 09:30 ..
>>> drwxr-xr-x  5 root root 128 Mar 31 18:11 files
>> 
>> So 'files' is a folder.
> 
> and that ls has been done in "data", which is a folder (notice that
> I'm logging in as root - bad practice, I know, but my enterprise one).
>> 
>> No sign of 'data'
>> 
> 
> This is the folder I'm doing the ls in, in fact.
> Sorry for the misunderstanding. Let me recapitulate.
> 
> I'm connecting to one machine where, when trying to open the "files"
> folder from the "data" file object using this command
> 
> root.getChild("appli").getChild("myappli").getChild("data").getChild("files")
> 
> I get this exception
> 
> org.apache.commons.vfs.FileSystemException: Could not list the
> contents of "sftp://root:perigee@quasar/appli/perigee_63D/data"
> because it is not a folder.
>       at org.apache.commons.vfs.provider.AbstractFileObject.getChildren(AbstractFileObject.java:527)
>       at org.apache.commons.vfs.provider.AbstractFileObject.getChild(AbstractFileObject.java:634)
>       at com.perigee.svnsync.SftpExecutor.existsContent(SftpExecutor.java:166)
>       at com.perigee.svnsync.SvnSynchronizer.examineRelease(SvnSynchronizer.java:32)
>       at com.perigee.svnsync.SvnSynchronizer.synchronize(SvnSynchronizer.java:86)
>       at com.perigee.svnsync.Main.run(Main.java:125)
>       at com.perigee.svnsync.Main.main(Main.java:110)
> 
> Unfortunatly, btoh "data" and "files" seems to be folders, at least
> from these commands :
> 
> server:/appli/myappli/data # pwd
> /appli/perigee_63D/data
> quasar:/appli/myappli/data # ls -la
> total 1
> drwxr-xr-x  3 root root  72 Jan 25  2010 .
> drwxr-xr-x 20 root root 880 Sep  6 09:30 ..
> drwxr-xr-x  5 root root 128 Mar 31 18:11 files
> 
> So, what am i doing wrong ?
> 
> -- 
> Nicolas Delsaux
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: [VFS][SFTP] Unable to navigate to directory

Posted by Nicolas Delsaux <ni...@gmail.com>.
On Wed, Sep 15, 2010 at 12:52 PM, sebb <se...@gmail.com> wrote:
>
> So 'data' is not a folder.
>

Well ... it is, because
>>
>>
>> Unfortunatly, a ls indicates that
>>
>> total 1
>> drwxr-xr-x  3 root root  72 Jan 25  2010 .
>> drwxr-xr-x 20 root root 880 Sep  6 09:30 ..
>> drwxr-xr-x  5 root root 128 Mar 31 18:11 files
>
> So 'files' is a folder.

and that ls has been done in "data", which is a folder (notice that
I'm logging in as root - bad practice, I know, but my enterprise one).
>
> No sign of 'data'
>

This is the folder I'm doing the ls in, in fact.
Sorry for the misunderstanding. Let me recapitulate.

I'm connecting to one machine where, when trying to open the "files"
folder from the "data" file object using this command

root.getChild("appli").getChild("myappli").getChild("data").getChild("files")

I get this exception

org.apache.commons.vfs.FileSystemException: Could not list the
contents of "sftp://root:perigee@quasar/appli/perigee_63D/data"
because it is not a folder.
       at org.apache.commons.vfs.provider.AbstractFileObject.getChildren(AbstractFileObject.java:527)
       at org.apache.commons.vfs.provider.AbstractFileObject.getChild(AbstractFileObject.java:634)
       at com.perigee.svnsync.SftpExecutor.existsContent(SftpExecutor.java:166)
       at com.perigee.svnsync.SvnSynchronizer.examineRelease(SvnSynchronizer.java:32)
       at com.perigee.svnsync.SvnSynchronizer.synchronize(SvnSynchronizer.java:86)
       at com.perigee.svnsync.Main.run(Main.java:125)
       at com.perigee.svnsync.Main.main(Main.java:110)

Unfortunatly, btoh "data" and "files" seems to be folders, at least
from these commands :

server:/appli/myappli/data # pwd
/appli/perigee_63D/data
quasar:/appli/myappli/data # ls -la
total 1
drwxr-xr-x  3 root root  72 Jan 25  2010 .
drwxr-xr-x 20 root root 880 Sep  6 09:30 ..
drwxr-xr-x  5 root root 128 Mar 31 18:11 files

So, what am i doing wrong ?

-- 
Nicolas Delsaux

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: [VFS][SFTP] Unable to navigate to directory

Posted by sebb <se...@gmail.com>.
On 15 September 2010 09:51, Nicolas Delsaux <ni...@gmail.com> wrote:
> Hi all
> following my previous question, I have a new issue regarding
> navigation to a SFTP directory.
> I connect to a remote SFTP server by first creating a FileObject
> linked to its root folder, then I try to open a subdirectory by
> calling resolveFile, but it seems to fail "in the middle". Here is the
> code :
>
>                        FileObject root = fsManager.resolveFile("sftp:username:password@server/");
>                        FileObject target =
> root.resolveFile("appli/myappli/data/files/ged_bur%250"));
>
>                        return target.getChildren().length>0;
>
> I initially used target.exists(), but as it did not seems to work, I
> tried to check for directory content, but it also fails.
> Notice that when I ssh "by hand" to this server (with same username
> and password), I can without any trouble navigate to this directory.
> I done further exploration and notice that writing, in my debug
> console the following succeeded
>
> root.getChild("appli").getChild("myappli").getChild("data")
>
> while the following failed
>
> root.getChild("appli").getChild("myappli").getChild("data").getChild("files")
>
> with this exception
>
> org.apache.commons.vfs.FileSystemException: Could not list the
> contents of "sftp://root:perigee@quasar/appli/perigee_63D/data"
> because it is not a folder.

So 'data' is not a folder.

>        at org.apache.commons.vfs.provider.AbstractFileObject.getChildren(AbstractFileObject.java:527)
>        at org.apache.commons.vfs.provider.AbstractFileObject.getChild(AbstractFileObject.java:634)
>        at com.perigee.svnsync.SftpExecutor.existsContent(SftpExecutor.java:166)
>        at com.perigee.svnsync.SvnSynchronizer.examineRelease(SvnSynchronizer.java:32)
>        at com.perigee.svnsync.SvnSynchronizer.synchronize(SvnSynchronizer.java:86)
>        at com.perigee.svnsync.Main.run(Main.java:125)
>        at com.perigee.svnsync.Main.main(Main.java:110)
>
>
> Unfortunatly, a ls indicates that
>
> total 1
> drwxr-xr-x  3 root root  72 Jan 25  2010 .
> drwxr-xr-x 20 root root 880 Sep  6 09:30 ..
> drwxr-xr-x  5 root root 128 Mar 31 18:11 files

So 'files' is a folder.

No sign of 'data'

>
> yes, as I expected, files is a directory.
>
> Notice that I can also do all those SSH operations using, as an
> example, WinSCP. Which leads me to think that this may not be a
> server-side issue, but rather a problem with my use of commons VFS.
>
> So, have you got any suggestions regarding this particular issue ?

Make sure the operations really are identical.

They don't appear to be from your description.

> Thanks
>
> --
> Nicolas Delsaux
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org