Menu

#863 Nlist against win. IIS behaves bizar

open
ftp (55)
5
2006-10-25
2006-10-25
No

Hi,
Tested with tcllib 1.9 (ftp 2.4.4)
(Test cases perform different be also 'strange' with
tcllib 1.8) AGAINST A WINDOWS IIS server! When I test
against a Solaris machine everything works fine.

ftp::NList handle ?directory?
When directory is passed I encountered following problems:

Case1: directory has >1 node and NOT ending with a slash
(eg. edidata/Catalog )The resulting files are prefixed
with the entire directory. Correct I think BUT the
filename portion is separared with a backslash (should
be slash). The directory keeps his slash.

Case2: When I append a slash to directory
(edidata/Catalog/). This solves the problem.
(This is the correct behaviour I think.)

Case3: directory is only one node and NOT ending with a
slash (eg. Catalog ) the resulting files are NOT
PREFIXED with the directory name. (which should be I
think, altough not documented)

Case4: When I append a slash to directory
(edidata/Catalog/). This solves the problem
(This is the correct behaviour I think.)

Testcases:
on ftp server directory structure:
editdata/Catalog
Catalog contains some files eg.
einpr45012023322_I.XML einpr45012023322_I.XML

package require ftp

set h_ftp [ftp::Open 10.17.100.239 myUser myPwd -port
23 -mode active]

# Case 1
ftp::NList $h_ftp edidata/Catalog

# Case 2
ftp::NList $h_ftp edidata/Catalog/

ftp::Cd $h_ftp edidata

# Case 3
ftp::NList $h_ftp Catalog

# Case 4
ftp::NList $h_ftp Catalog/

Output AGAINST IIS ftp server WITH the option Directory
listing style = 'MS-DOS':
% package require ftp
2.4.4
%
% set h_ftp [ftp::Open 10.17.100.239 myUser myPwd -port
23 -mode active]
0
%
% # Case 1
% ftp::NList $h_ftp edidata/Catalog
{edidata/Catalog\einpr45012023322_I.XML}
{edidata/Catalog\einpr47121440651_I.XML
}
%
% # Case 2
% ftp::NList $h_ftp edidata/Catalog/
edidata/Catalog/einpr45012023322_I.XML
edidata/Catalog/einpr47121440651_I.XML
%
% ftp::Cd $h_ftp edidata
1
%
% # Case 3
% ftp::NList $h_ftp Catalog
einpr45012023322_I.XML einpr47121440651_I.XML
%
% # Case 4
% ftp::NList $h_ftp Catalog/
Catalog/einpr45012023322_I.XML
Catalog/einpr47121440651_I.XML

Output (OK I think) AGAINST SOLARIS machine (ftpd daemon):

% package require ftp
2.4.4
%
% set h_ftp [ftp::Open srvdev myUser myPwd -port 21
-mode active]
0
%
% # Case 1
% ftp::NList $h_ftp edidata/Catalog
edidata/Catalog/einpr45012023322_I.XML
edidata/Catalog/einpr47121440651_I.XML
%
% # Case 2
% ftp::NList $h_ftp edidata/Catalog/
edidata/Catalog/einpr45012023322_I.XML
edidata/Catalog/einpr47121440651_I.XML
%
% ftp::Cd $h_ftp edidata
1
%
% # Case 3
% ftp::NList $h_ftp Catalog
Catalog/einpr45012023322_I.XML
Catalog/einpr47121440651_I.XML
%
% # Case 4
% ftp::NList $h_ftp Catalog/
Catalog/einpr45012023322_I.XML
Catalog/einpr47121440651_I.XML

Output AGAINST IIS with directory listing style = 'UNIX':
% package require ftp
2.4.4
%
% set h_ftp [ftp::Open 10.17.100.239 els.vedior
mon23oct -port 23 -mode active]
0
% # Case 1
% ftp::NList $h_ftp edidata/Catalog
edidata/Catalog/einpr45012023322_I.XML
edidata/Catalog/einpr47121440651_I.XML
%
% # Case 2
% ftp::NList $h_ftp edidata/Catalog/
edidata/Catalog/einpr45012023322_I.XML
edidata/Catalog/einpr47121440651_I.XML
%
% ftp::Cd $h_ftp edidata
1
%
% # Case 3
% ftp::NList $h_ftp Catalog
einpr45012023322_I.XML einpr47121440651_I.XML
%
% # Case 4
% ftp::NList $h_ftp Catalog/
Catalog/einpr45012023322_I.XML
Catalog/einpr47121440651_I.XML

THIS IS ALMOST CORRECT in "Case 3" the file is not
prefixed with the directory.

My Workarounds:
1) Avoid IIS
2) If IIS: set directory listing to UNIX, and do not
use single node directories (I added an extra directory
level just to avoid this problem)

Discussion

  • Christophe De Clercq

    Logged In: YES
    user_id=617750

    Extra scenario:
    Installed apache ftp server from
    http://incubator.apache.org/ftpserver/ on win-xp (all default).

    And the output is (as you can see even other behaviour,
    nothing is prefixed now):
    % package require ftp
    2.4.4
    %
    % set h_ftp [ftp::Open 10.17.101.53 anonymous myPwd -port 21
    -mode active]
    0
    % # Case 1
    % ftp::NList $h_ftp edidata/Catalog
    einpr45012023322_I.XML einpr47121440651_I.XML
    % # Case 2
    % ftp::NList $h_ftp edidata/Catalog/
    einpr45012023322_I.XML einpr47121440651_I.XML
    % ftp::Cd $h_ftp edidata
    1
    % # Case 3
    % ftp::NList $h_ftp Catalog
    einpr45012023322_I.XML einpr47121440651_I.XML
    % # Case 4
    % ftp::NList $h_ftp Catalog/
    einpr45012023322_I.XML einpr47121440651_I.XML

     
  • Michael Schlenker

    Logged In: YES
    user_id=302287

    The ftp packages NList command basically just passes through
    whatever it receives from the FTP server, without
    postprocessing, so you directly see the server differences
    (similar to what you would see if you used a typical command
    line ftp client).

    The RFC does not make any real assumptions how the returned
    filenames have to look like:

    NAME LIST (NLST)

    This command causes a directory listing to be
    sent from
    server to user site. The pathname should specify a
    directory or other system-specific file group
    descriptor; a
    null argument implies the current directory.
    The server
    will return a stream of names of files and no other
    information. The data will be transferred in
    ASCII or
    EBCDIC type over the data connection as valid
    pathname
    strings separated by <CRLF> or <NL>. (Again the
    user must
    ensure that the TYPE is correct.) This command
    is intended
    to return information that can be used by a
    program to
    further process the files automatically. For
    example, in
    the implementation of a "multiple get" function.

    It talks about 'valid pathname', if the results you see do
    not match the description in the RFC the server is buggy.
    The exact specification for 'pathname' is vague at best:

    pathname

    Pathname is defined to be the character string
    which must be
    input to a file system by a user in order to
    identify a file.
    Pathname normally contains device and/or directory
    names, and
    file name specification. FTP does not yet specify
    a standard
    pathname convention. Each user must follow the
    file naming
    conventions of the file systems involved in the
    transfer.

    The only 'safe' way i see is to CD to the working directory
    your interested in an invoke the NLIST command there, as
    that excludes all directory name prefix issues.

     
  • Christophe De Clercq

    Logged In: YES
    user_id=617750

    I did some extra testing and I now convinced this is a
    ftp-server problem, not a tlclib problem. (thanks mic42 for
    the remark)
    * If you want to Use set directory listing to UNIX (to solve
    backslash problem)
    * Always add a slash to the end of a directory when using
    NList (solves directory prefixing)

    Is this something to add to the doc. as a remark ?