Subject: Re: FTP: LIST vs. NLST
To: Trevin Beattie <trevin@xmission.com>
From: Robert Elz <kre@munnari.OZ.AU>
List: netbsd-users
Date: 01/31/2001 10:10:55
    Date:        Tue, 30 Jan 2001 12:48:28 -0800
    From:        Trevin Beattie <trevin@xmission.com>
    Message-ID:  <3.0.32.20010130124825.00683d58@clay.wh.ca.us>

  | I have recently run into a problem with the interpretation of RFC-959.
  | The authors of wu-ftpd claim that NLST should restrict its list to
  | regular files and exclude directories and symbolic links.

That's wrong.   Or more correctly, an FTP server can return whatever it
likes for any of the listing commands - FTP provides a virtual filestore,
it doesn't have to represent anything that actually exists if it doesn't
want to.  So the "should" is incorrect, there's no such requirement.
But restricting it that way isn't necessarily wrong either.

  | In the official standard, RFC-959, the ONLY distinction made between
  | NLST and LIST is that NLST must return a machine-readable list of
  | names, while LIST may return a human-readable list.

Yes.

  | NetBSD Problem Report #8937 has suggested changing the implementation
  | of ftp to make "dir" and "ls" both use LIST.  I believe this is a
  | mistake, as it removes the distinction between the commands.

NLST output is intended for machine processing, returning it (raw) to
the user is a dumb idea.

The "ls" and "dir" came about because unix users naturally like to use
"ls", whereas most ftp clients pre unix had used "dir" as their command
for the similar function (those other OS's...).   So, both were included.
They're not supposed to be different (that some version of the unix client
somewhere along the way changed "ls" to use "NLST" was a truly brain
dead idea).

Things got worse as servers tended to just run /bin/ls to implement these
commands, passing whatever arg the user passed, so running "ls -lrt" from
the client would cause the server to run "/bin/ls -lrt" the output of
which was just dumped to the user's screen, which made things look very
clean to your average unix user.   Try that on a non-unix server though
and it wouldn't do at all what you expect (except those faked to pretend
to be unix, which actually look to see if you're passing unix style flags
as the arg ... the lengths to which some implementors will go...)

The only defined arg to the LIST/NLST commands is the file to list, there
are, or should be, no "flags".

In the future, clients will be able to use MLST and then generate
different output formats suitable for the client environment, based
upon the command they were given, and the information returned from
the server   (There are already servers, including NetBSD's, that
support it).

  | ... So, does anyone know how to get these comments to the RFC group?

Well, I am a part of it, so in a sense you have already.   But to
get to the IETF people currently working on ftp, use ftp-wg@hethmon.com

kre