The ftp server is the standard Solaris in.ftpd daemon.
The Solaris 9 server is actually Solaris x86 a.k.a. Solaris for Intel:
[oracle@sunshine] /export/home/oracle
-> uname -a
SunOS sunshine 5.9 Generic_117172-17 i86pc i386 i86pc
The Solaris 10 server is a SunFire V440 SPARC box:
[oracle@delos] /export/home/oracle
-> uname -a
SunOS delos 5.10 Generic_118822-19 sun4u sparc SUNW,Sun-Fire-V440
I haven't seen any difference in their behaviour - Solaris tends to be good at that.
Using command line ftp the output from "ls -l" and "dir" are identical and the same as would be obtained from a shell prompt.
The output from "ls" is also the same as from a shell prompt.
Now, here's an interesting thing. Trying to re-create the problem or at least the diagnostics for same this morning I found that if I invoke dir(<directoryname>, true) WITHOUT first issuing a call to chdir(<directory>) there is no problem.
Furthermore, if I chdir(".") which is clearly useless but harmless there is still no problem.
Once a chdir(<some useful directory>) has been issued, the dir(<directoryname>, true) then behaves per the original 'bug' posting. (At an ftp comamnd line prompt the results is cd <directory> then "ls -l" are as expected).
My modified FTPClient.java code (from line 2105 in the original is):
LineNumberReader in = null;
Vector lines = new Vector();
try {
in = new LineNumberReader(
new InputStreamReader(data.getInputStream()));
// read a line at a time
String line = null;
while ((line = readLine(in)) != null)
{
lines.addElement(line);
log.info("FTP cmd " +command +" ->{" +line +"}"); // RSH debugging
}
}
The log.info is obviously the critical piece of information. Part of a sample run showing what happens is below:
>java -jar Z:\javaProjects\test\build\ftp.jar -hdelos -uoracle -p******
-d/u20/oradata/PWEB -D -tBIN -D PUT test.xml
INFO [com.enterprisedt.Demo] 17 Aug 2006 09:52:28.695 : Setting bandwidth to -1
INFO [com.enterprisedt.Demo] 17 Aug 2006 09:52:28.757 : Connecting
INFO [com.enterprisedt.Demo] 17 Aug 2006 09:52:28.961 : Logging in
INFO [com.enterprisedt.Demo] 17 Aug 2006 09:52:29.148 : Changing directory to /u
20/oradata/PWEB
INFO [com.enterprisedt.net.ftp.FTPClient] 17 Aug 2006 09:52:29.257 : Remote syst
em is UNIX Type: L8 Version: SUNOS
INFO [com.enterprisedt.net.ftp.FTPClient] 17 Aug 2006 09:52:29.507 : FTP cmd LIS
T . ->{-rw-r--r-- 1 oracle oinstall 9449 Aug 17 09:53 test.xml}
INFO [com.enterprisedt.net.ftp.FTPClient] 17 Aug 2006 09:52:29.507 : FTP cmd LIS
T . ->{-rw-r--r-- 1 oracle oinstall 8584 Feb 4 2006 weblimsphos.log}
INFO [com.enterprisedt.net.ftp.FTPClient] 17 Aug 2006 09:52:29.507 : FTP cmd LIS
T . ->{}
INFO [com.enterprisedt.net.ftp.FTPClient] 17 Aug 2006 09:52:29.507 : FTP cmd LIS
T . ->{arch:}
INFO [com.enterprisedt.net.ftp.FTPClient] 17 Aug 2006 09:52:29.507 : FTP cmd LIS
T . ->{total 2109312}
INFO [com.enterprisedt.net.ftp.FTPClient] 17 Aug 2006 09:52:29.507 : FTP cmd LIS
T . ->{-rw-r----- 1 oracle oinstall 19135695 Aug 11 09:04 log575046937_1_000
0004204.arc.Z}
INFO [com.enterprisedt.net.ftp.FTPClient] 17 Aug 2006 09:52:29.507 : FTP cmd LIS
T . ->{-rw-r----- 1 oracle oinstall 18905778 Aug 11 15:39 log575046937_1_000
0004205.arc.Z}
and so on.
An "ls -l /u20/oradata/PWEB" would show:
[oracle@delos] /u20/oradata/PWEB
-> ls -l
total 64
drwxr-xr-x 2 oracle oinstall 12288 Aug 17 10:11 arch
drwxr-xr-x 2 oracle oinstall 512 Jan 10 2006 ctl
-rw-r--r-- 1 oracle oinstall 9449 Aug 17 09:54 test.xml
-rw-r--r-- 1 oracle oinstall 8584 Feb 4 2006 weblimsphos.log
So recursion into the "arch" directory is taking place. (I omitted the full test output which shows recursion
into "ctl" as well).
As if that is not weird/annoying enough, I've experimented with the code that invokes dirDetails() in the calling program
and found more quirks.
Normally when using ftp at the command line, if one wants to get a full directory listing, the order of events would be
1) ftp <hostname>
2) <supply credentials>
3) cd <directory>
4) ls -l
Using
4) ls -l <directory>
jus doesn't work with or without step 3) - although ls <directory> does irrespective of execution of step 3).
Anyhow, in coding the calls to FTPClient, I just followed the steps 1) to 4) approach above and consequently issued
a dirDetails("."). If, instead, I issue a dirDetails(<directory I have changed to>), everything works.
And I haven't even begun to visit the fairy tale (witches?) world of Microsoft!
CONCLUSION
==========
IT'S NOT WORTH LOSING ANY SLEEP OVER THIS - WE/I JUST NEED TO CODE 'CORRECTLY'
Cheers.