Bug 21144 - [PATCH] fetch(1): don't bonk if ftp SIZE isn't supproted; add LIST feature
Summary: [PATCH] fetch(1): don't bonk if ftp SIZE isn't supproted; add LIST feature
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 4.1-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: Dag-Erling Smørgrav
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2000-09-09 09:00 UTC by Craig Leres
Modified: 2001-05-27 14:14 UTC (History)
1 user (show)

See Also:


Attachments
file.diff (2.50 KB, patch)
2000-09-09 09:00 UTC, Craig Leres
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Craig Leres freebsd_committer 2000-09-09 09:00:01 UTC
	If you try to grab a ftp file and the server does not
	support the SIZE command, fetch(1) gets confused and exits.

	The "old" version of fetch could cope with this.

	Also, fetch(1) cannot retreive a ftp directory listing;
	attempts to do so result in a ftp protocol error.

Fix: The appended context diff to lib/libfetch/ftp.c makes these
	changes:

	     - Ignore a syntax/protocol error when fetching a file

	     - Detecting that the filename is empty and do a LIST
	       instead of a RETR

	I submitted a similar patch for the 3.0-RELEASE version of
	fetch:

	    http://www.FreeBSD.org/cgi/query-pr.cgi?pr=9250

	Since the current version of fetch looks like a rewrite,
	you can probbaly close the old report.


===================================================================
RCS file: RCS/ftp.c,v
retrieving revision 1.1
How-To-Repeat: 
	fun 436 % fetch -v ftp://ftp.rs.internic.net/domain/named.root
	looking up ftp.rs.internic.net
	connecting to ftp.rs.internic.net:21
	fetch: named.root: Syntax error, command unrecognized

	[Too bad fetch can't show us the protocol dialogue; that
	would be sweet!]

	fun 433 % ftp ftp.rs.internic.net
	Connected to ftp.rs.internic.net.
	220 rs FTP server (InterNIC Public FTP Server - Login with username anonymous) ready.
	Name (ftp.rs.internic.net:leres): ftp
	331 Guest login ok, send ident as password.
	Password:
	230 Guest login ok, access restrictions apply.
	Remote system type is UNIX.
	Using binary mode to transfer files.
	ftp> cd /domain
	250 CWD command successful.
	ftp> quote SIZE named.root
	500 'SIZE named.root': command not understood.
	ftp> 

	[Here's how the fetch that came with 3.2-RELEASE works;
	note the useful debugging info...]

	ee 66 % uname -r 
	3.2-RELEASE
	ee 67 % fetch ftp://ftp.rs.internic.net/domain/named.root
	fetch: domain/named.root: cannot get remote modification time
	Receiving named.root: 2 Kbytes
	2769 bytes transfered in 0.8 seconds  (3.52 Kbytes/s)
	ee 68 % ,ch,ch -v
	fetch -v ftp://ftp.rs.internic.net/domain/named.root
	Sending: USER anonymous
	rs FTP server (InterNIC Public FTP Server - Login with username anonymous) ready.
	Guest login ok, send ident as password.
	Sending: PASS leres@ee.lbl.gov
	Guest login ok, access restrictions apply.
	Sending: TYPE I
	Type set to I.
	Sending: CWD domain
	CWD command successful.
	Sending SIZE named.root
	'SIZE named.root': command not understood.
	Sending MDTM named.root
	'MDTM named.root': command not understood.
	fetch: domain/named.root: cannot get remote modification time
	Sending: PORT 131,243,1,10,192,18
	PORT command successful.
	Sending: RETR named.root
	Binary data connection for named.root (131.243.1.10,49170) (2769 bytes).
	Receiving named.rootSending: QUIT
	Binary Transfer complete.
	Goodbye.
	Receiving named.root: 2 Kbytes
	2769 bytes transfered in 3.8 seconds  (722 bytes/s)

	[Here's an unsuccessful attempt to get a directory listing]

	fun 450 % fetch -v ftp://ftp.ee.lbl.gov/
	looking up ftp.ee.lbl.gov
	connecting to ftp.ee.lbl.gov:21
	fetch: fetch.out: Syntax error in parameters or arguments
Comment 1 sheldonh freebsd_committer 2000-09-12 19:49:49 UTC
Responsible Changed
From-To: freebsd-bugs->des

This is definitely fixed in the development branch of FreeBSD. 
The maintainer will have a better idea of whether it's fixed 
in 4.1-STABLE.
Comment 2 Dag-Erling Smørgrav freebsd_committer 2001-05-27 14:13:44 UTC
State Changed
From-To: open->closed

SIZE issue fixed.  LIST issue partially fixed in different manner.