Bug 33856

Summary: "fetch -o" gives bogus error message
Product: Base System Reporter: Gregory Bond <gnb>
Component: binAssignee: Dag-Erling Smørgrav <des>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.5-PRERELEASE   
Hardware: Any   
OS: Any   

Description Gregory Bond 2002-01-14 02:40:00 UTC
A command like
	fetch -o /existing/dir ftp:/non/existent/file
will give the bogus error message
	fetch: /existing/dir/file: Not Found

This is bogus (or at least highly misleading) because it is not
the local file that is not found, but the remote one.

Without the -o file, then it gives a more reasonable message:
	$ fetch ftp://ftp.freeBSD.org/pub/FreeBSD/not-here
	fetch: not-here: Not Found
	$

Fix: 

Unknown.
How-To-Repeat: 
$ fetch -o /tmp ftp://ftp.freeBSD.org/pub/FreeBSD/not-here
fetch: /tmp/not-here: Not Found
$ 

[NB: I'm using an HTTP_PROXY environment variable if that makes any difference.]
Comment 1 Crist J. Clark freebsd_committer freebsd_triage 2002-01-14 08:46:23 UTC
Responsible Changed
From-To: freebsd-bugs->des

Over to fetch(1) maintainer.
Comment 2 danp 2002-02-03 22:08:08 UTC
This patch fixes the problem for me:

Index: fetch.c
===================================================================
RCS file: /home/ncvs/src/usr.bin/fetch/fetch.c,v
retrieving revision 1.10.2.17
diff -u -r1.10.2.17 fetch.c
--- fetch.c	2001/12/18 09:48:09	1.10.2.17
+++ fetch.c	2002/02/03 22:05:17
@@ -359,7 +359,7 @@
 
 	/* start the transfer */
 	if ((f = fetchXGet(url, &us, flags)) == NULL) {
-		warnx("%s: %s", path, fetchLastErrString);
+		warnx("%s: %s", URL, fetchLastErrString);
 		goto failure;
 	}
 	if (sigint)

Example:

$ ./fetch -o /tmp ftp://ftp.freebsd.org/pub/FreeBSD/not-here
fetch: ftp://ftp.freebsd.org/pub/FreeBSD/not-here: File unavailable (e.g., file not found, no access)

-- 
Dan Peterson <danp@danp.net> http://danp.net
Comment 3 danp 2002-02-03 22:30:53 UTC
Ahh, perhaps I was too hasty. fetch likes to tell you the final component of
a URL had problems. Example:

$ /usr/bin/fetch ftp://ftp.freebsd.org/pub/FreeBSD/not-here
fetch: not-here: File unavailable (e.g., file not found, no access)
$ /usr/bin/fetch -o /tmp/foo ftp://ftp.freebsd.org/pub/FreeBSD/not-here
fetch: /tmp/foo: File unavailable (e.g., file not found, no access)

The final component is the default value for the "path" variable used in
warnx() if fetchXGet() returns NULL, but it gets set to the full filename of
the outfile if used with -o. It would be nice if it used the final component
of the URL in either case but perhaps it's intended behavior that it
doesn't.

-- 
Dan Peterson <danp@danp.net> http://danp.net
Comment 4 Dag-Erling Smørgrav freebsd_committer freebsd_triage 2002-12-04 10:32:37 UTC
State Changed
From-To: open->closed

MFCed.