ftp user mls/mdir commands don't work right

mogul%coyote at sri-unix.UUCP mogul%coyote at sri-unix.UUCP
Wed Mar 21 11:35:50 AEST 1984


From:  Jeff Mogul <mogul at coyote>

Description:
	The syntax for the mls and mdir commands is
		mdir remote-pathname local-filename
	Unless local-filename is "-", ftp (cryptically and 
	uncharacteristicly) asks for confirmation (presumably,
	meaning "do you really want to write on this file?"
	
	However, if you type "n" or "N", it goes ahead and
	writes the file, while if you type anything else (a positive
	response) it gives up.
	
	Essentially the same bug causes a problem with a "globbed"
	local-filename that doesn't match any extant file; ftp will
	instead create a file with the metacharacters in the filename.

Repeat-By:
	% ftp localhost
	... login ...
	ftp> mls /etc /tmp/foo
	local-file /tmp/foo? y
	ftp>
	ftp> mls /etc /tmp/foo
	local-file /tmp/foo? n
	mls ac? ...
	 .
	 .
	 .
	ftp> mls /etc/ /tmp/This*does*not*exist
	local-file /tmp/This*does*not*exist? n
	 .
	 .
	 .
	ftp> bye
	% ls /tmp/This*does*not*exist
	This*does*not*exist
	%
Fix:
*** cmds.c	Tue Mar 20 16:40:02 1984
--- cmds.c.old	Tue Jul 26 21:34:47 1983
***************
*** 703,709
  	dest = argv[argc - 1];
  	argv[argc - 1] = NULL;
  	if (strcmp(dest, "-"))
! 		if (!globulize(&dest) || !confirm("local-file", dest))
  			return;
  	cmd = argv[0][1] == 'l' ? "NLST" : "LIST";
  	for (mode = "w"; cp = remglob(argc, argv); mode = "a")

--- 703,709 -----
  	dest = argv[argc - 1];
  	argv[argc - 1] = NULL;
  	if (strcmp(dest, "-"))
! 		if (globulize(&dest) && confirm("local-file", dest))
  			return;
  	cmd = argv[0][1] == 'l' ? "NLST" : "LIST";
  	for (mode = "w"; cp = remglob(argc, argv); mode = "a")

Comment:
	All the m* commands are next to worthless unless you've
	read the code and understand how they are implemented; all
	sorts of things are counter-intuitive.

	For example, try this:
	
	ftp> cd /usr
	ftp> mls * -

	or this:
	
	ftp> cd /usr
	ftp> mls /bin -



More information about the Comp.unix.wizards mailing list