bin/176697: incorrect fetch(1) exit codes with -s option versus ftp proxy use

Matthias Andree mandree at FreeBSD.org
Wed Mar 6 19:20:00 UTC 2013


>Number:         176697
>Category:       bin
>Synopsis:       incorrect fetch(1) exit codes with -s option versus ftp proxy use
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Mar 06 19:20:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Matthias Andree
>Release:        FreeBSD 9.1-RELEASE amd64
>Organization:
>Environment:
System: FreeBSD apollo.emma.line.org 9.1-RELEASE FreeBSD 9.1-RELEASE #2 r244869: Sun Dec 30 22:05:16 CET 2012 toor at apollo.emma.line.org:/usr/obj/usr/src/sys/GENERIC amd64


	
>Description:
fetch -s exit codes are not consistent across proxy vs. non-proxy
setups when checking for a non-existent file on an ftp server, with
fetch -svv ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/8.3-RELEASE/base.txz

With Squid as proxy, we get exit code 1 (correct) and an error message.

Without proxy, we get "Unknown" as result, and an exit code of 0 (bogus).
Since fetch failed to obtain the requested file size, it must not use
EXIT_SUCCESS (0), but must report the error.

Expected behaviour: fetch should, when it is unable to obtain the file size,
always exit with code 1 after printing an error message.

Log, first the correct case with proxy:

$ fetch -svv ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/8.3-RELEASE/base.txz ; echo $?
scheme:   [ftp]
user:     []
password: []
host:     [ftp.freebsd.org]
port:     [0]
document: [/pub/FreeBSD/releases/amd64/8.3-RELEASE/base.txz]
scheme:   [http]
user:     []
password: []
host:     [proxy]
port:     [8080]
document: [/]
---> proxy:8080
looking up proxy
connecting to proxy:8080
requesting ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/8.3-RELEASE/base.txz
>How-To-Repeat:
	
>Fix:

	


>Release-Note:
>Audit-Trail:
>Unformatted:
 >>> HEAD ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/8.3-RELEASE/base.txz HTTP/1.1
 >>> Host: ftp.freebsd.org
 >>> User-Agent: fetch libfetch/2.0
 >>> Connection: close
 >>> 
 <<< HTTP/1.1 404 Not Found
 <<< Server: squid/3.2.7
 <<< Mime-Version: 1.0
 <<< Date: Wed, 06 Mar 2013 18:33:46 GMT
 <<< Content-Type: text/html
 <<< Content-Length: 3807
 <<< X-Squid-Error: ERR_FTP_NOT_FOUND 0
 content length: [3807]
 <<< Vary: Accept-Language
 <<< Content-Language: en
 <<< X-Cache: MISS from proxy.madpilot.net
 <<< Via: 1.1 proxy.madpilot.net (squid/3.2.7)
 <<< Connection: close
 <<< 
 offset 0, length -1, size -1, clength 3807
 fetch: Not Found
 1
 
 Now the faulty one, without proxy:
 
 $ /usr/bin/fetch -svvv ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/8.3-RELEASE/base.txz ; echo $?
 scheme:   [ftp]
 user:     []
 password: []
 host:     [ftp.freebsd.org]
 port:     [0]
 document: [/pub/FreeBSD/releases/amd64/8.3-RELEASE/base.txz]
 ---> ftp.freebsd.org:21
 looking up ftp.freebsd.org
 connecting to ftp.freebsd.org:21
 <<< 220 beastie.tdk.net FTP server (Version 6.00LS) ready.
 >>> USER anonymous
 <<< 331 Guest login ok, send your email address as password.
 >>> PASS mandree at apollo.emma.line.org
 <<< 230 Guest login ok, access restrictions apply.
 >>> PWD
 <<< 257 "/" is current directory.
 >>> CWD pub/FreeBSD/releases/amd64/8.3-RELEASE
 <<< 250 CWD command successful.
 >>> MODE S
 <<< 200 MODE S accepted.
 >>> TYPE I
 <<< 200 Type set to I.
 >>> SIZE base.txz
 <<< 550 base.txz: No such file or directory.
 >>> QUIT
 <<< 221 Goodbye.
 Unknown
 0
 
 	


More information about the freebsd-bugs mailing list