This problem happens with Jsch-0.1.34 and Jsch-0.1.31
(I did not check other versions).

Given a remote UNIX directory with an '?' or '*' in its name,
for instance /parent/a?b

Even if the path name is quoted ("/parent/a\\?b"), calling
ChannelSftp.ls(quotedDir) does not return the contents of 
dir, but it returns the list of file which reside in 
parent/ and match the pattern a?b.

The reason for this problem is that
   ChannelSftp.isPattern()
just checks for occurrence of the characters '?' and '*',
but does not check whether these characters have been quoted
with a \ or not.

A slightly related problem to this is that unquoting of
path names is done in the encoded byte[] array rather
than the Unicode String. Given remote path names that
are encoded in UTF-8 or similar, there can be characters
encoded as 2 or three bytes. It's possible that byte 
#2 or byte #3 happen to look like a '?' or '*' character,
but are actually not.

Therefore, the unquoting must happen in the Unicode string
rather than the encoded byte[] array -- Util.unquote()
must use String.toCharArray() and work on that one,
rather than String.getBytes().

Cheers,
--
Martin Oberhuber
Wind River Systems, Inc.
Target Management Project Lead, DSDP PMC Member
http://www.eclipse.org/dsdp/tm

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
JSch-users mailing list
JSch-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jsch-users

Reply via email to