Bug 15408

Summary: Description of ls and nlist wrong in man page for ftp
Product: Documentation Reporter: inwap <inwap>
Component: Books & ArticlesAssignee: ben <ben>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description inwap 1999-12-10 22:20:01 UTC
	There is an undocumented change in the behavior of the 'ls' command
inside the ftp client program.  With older versions of ftp (such as the ones
use by Sun), the difference between 'ls' and 'dir' is that the former
sends the NLST command to get a list of names only and the latter sends
LIST to get a full directory listing (often done by executing `ls -l` on
the server).  The man page for ftp states that 'nlist' is an alias for
'ls' and that 'ls' will "print a list of the files in a directory on the
remote machine".

	The docs need to be changed to say that 'ls' is a synonym for 'dir'
and that 'nlist' has to be used to get a list of just the file names.

Fix: 

1) Change the program back so that 'ls' is synonymous with 'nlist'.
	or
2) Change the docs to show that 'ls' is different from 'nlist'.

	Update the man page, so that the paragraph on 'dir' includes
a statement how 'dir' differs from 'nlist'.  Replace the paragraph on
'ls' with "ls [remote-directory [local-file]]\nA synonym for dir."
Move the old description of 'ls' to 'nlist'.  Make it clear that,
according to the RFC, this command returns a list of files on the
remote machine, explictly excluding the names of any subdirectories
in the remote directory.  (The wu-ftpd-2.6.0 server enforces this.)
How-To-Repeat: 
ftp> debug
ftp> dir .cshrc
ftp> ls .cshrc
ftp> nlist .cshrc

Note from the response that 'ls' acts like 'dir' and not 'nlist'.
Comment 1 ben freebsd_committer freebsd_triage 2000-07-11 01:58:21 UTC
>      2) Change the docs to show that 'ls' is different from 'nlist'.
> 
>              Update the man page, so that the paragraph on 'dir' includes
>      a statement how 'dir' differs from 'nlist'.

I'd rather the other way around, but I don't feel strongly either way.
It already explains that 'dir' returns system-dependent information.
How about adding something like this to the 'nlist' description:

	Note that this command only returns the filenames in the remote
	directory.  If you wish to see more information about the files
	(often size, modification time, and so on) use the dir command
	instead.

Perhaps something could be added to the 'dir' description too:

	If you want a plain list of files, with no extra information, use
	the nlist command instead.

ok?

>      Replace the paragraph on
>      'ls' with "ls [remote-directory [local-file]]\nA synonym for dir."
>      Move the old description of 'ls' to 'nlist'.

That's easy...

>      Make it clear that, according to the RFC, this command returns
>      a list of files on the remote machine, explictly excluding the
>      names of any subdirectories in the remote directory.  (The
>      wu-ftpd-2.6.0 server enforces this.)

What do you mean by "this command"?  The "nlist" client command?  The NLST
server command?  Either way, I don't see subdirectories excluded:

ftp> ls
---> PORT 192,168,91,33,192,13
200 PORT command successful.
---> LIST
150 Opening ASCII mode data connection for /bin/ls.
total 12
d--x--x--x   2 root  wheel   512 Apr  5 19:14 bin
d--x--x--x   2 root  wheel   512 Apr  5 19:18 etc
drwxrwx-wt   2 root  wheel   512 Apr  5 19:13 incoming
drwxr-xr-x   4 root  wheel   512 Aug 11  1999 local
drwxr-xr-x  39 root  bin    1024 Jul 10 01:34 packages
drwxr-xr-x   5 root  wheel   512 Jul  1 20:38 pub
226 Transfer complete.
ftp> dir
---> PORT 192,168,91,33,192,14
200 PORT command successful.
---> LIST
150 Opening ASCII mode data connection for /bin/ls.
total 12
d--x--x--x   2 root  wheel   512 Apr  5 19:14 bin
d--x--x--x   2 root  wheel   512 Apr  5 19:18 etc
drwxrwx-wt   2 root  wheel   512 Apr  5 19:13 incoming
drwxr-xr-x   4 root  wheel   512 Aug 11  1999 local
drwxr-xr-x  39 root  bin    1024 Jul 10 01:34 packages
drwxr-xr-x   5 root  wheel   512 Jul  1 20:38 pub
226 Transfer complete.
ftp> nlist
---> PORT 192,168,91,33,192,15
200 PORT command successful.
---> NLST
150 Opening ASCII mode data connection for file list.
bin
etc
incoming
local
packages
pub
226 Transfer complete.

Am I misunderstanding something?  The server in question is running
wu-ftpd-2.6.0.  Could you explain what should be happening a bit better?

thanks,

-- 
Ben Smithurst / ben@FreeBSD.org / PGP: 0x99392F7D
Comment 2 ben freebsd_committer freebsd_triage 2000-07-11 18:57:36 UTC
Responsible Changed
From-To: freebsd-doc->ben

I'm looking at this.
Comment 3 ben freebsd_committer freebsd_triage 2000-07-12 01:54:10 UTC
State Changed
From-To: open->feedback

I'm waiting for a reply from the submitter to clarify one issue regarding 
this PR.
Comment 4 ben freebsd_committer freebsd_triage 2000-07-12 17:01:53 UTC
>>      Make it clear that, according to the RFC, this command returns
>>      a list of files on the remote machine, explictly excluding the
>>      names of any subdirectories in the remote directory.  (The
>>      wu-ftpd-2.6.0 server enforces this.)

Unless I get a clarification of this point, I'll be committing this
patch shortly which addresses the main problem (that ls is not the same
as nlist, but is the same as dir).

Index: ftp.1
===================================================================
RCS file: /usr/cvs/src/usr.bin/ftp/ftp.1,v
retrieving revision 1.16
diff -u -r1.16 ftp.1
--- ftp.1	2000/06/12 18:30:15	1.16
+++ ftp.1	2000/07/11 01:03:01
@@ -297,6 +297,11 @@
 is
 .Sq Fl ,
 the output is sent to the terminal.
+.Pp
+As this command provides extra information which is system-dependent,
+you should use the
+.Ic nlist
+command instead if you only want a plain list of files.
 .It Ic disconnect
 A synonym for
 .Ic close .
@@ -419,22 +424,8 @@
 .It Ic lpwd
 Print the working directory on the local machine.
 .It Ic \&ls Op Ar remote-directory Op Ar local-file
-Print a list of the files in a
-directory on the remote machine.
-If
-.Ar remote-directory
-is left unspecified, the current working directory is used.
-If interactive prompting is on,
-.Nm
-will prompt the user to verify that the last argument is indeed the
-target local file for receiving
-.Ic ls
-output.
-If no local file is specified, or if
-.Ar local-file
-is
-.Fl  ,
-the output is sent to the terminal.
+A synonym for
+.Ic dir .
 .It Ic macdef Ar macro-name
 Define a macro.
 Subsequent lines are stored as the macro
@@ -543,8 +534,29 @@
 Otherwise, this command is identical to
 .Ar get .
 .It Ic nlist Op Ar remote-directory Op Ar local-file
-A synonym for
-.Ic ls .
+Print a list of the files in a
+directory on the remote machine.
+If
+.Ar remote-directory
+is left unspecified, the current working directory is used.
+If interactive prompting is on,
+.Nm
+will prompt the user to verify that the last argument is indeed the
+target local file for receiving
+.Ic ls
+output.
+If no local file is specified, or if
+.Ar local-file
+is
+.Fl  ,
+the output is sent to the terminal.
+.Pp
+Note that this command only returns the filenames in the remote
+directory.  If you wish to see more information about the files (often
+size, modification time, and so on),
+you should use the
+.Ic dir
+command instead.
 .It Ic nmap Op Ar inpattern outpattern
 Set or unset the filename mapping mechanism.
 If no arguments are specified, the filename mapping mechanism is unset.

-- 
Ben Smithurst / ben@FreeBSD.org / PGP: 0x99392F7D
Comment 5 ben freebsd_committer freebsd_triage 2000-07-19 20:02:09 UTC
State Changed
From-To: feedback->closed

Turns out the submitter was mistaken about the point I wanted to clarify. 
The other changed have been committed.