From obrien@Nuxi.cs.ucdavis.edu  Sat Aug  3 00:49:53 1996
Received: from relay.nuxi.com (nuxi.cs.ucdavis.edu [128.120.56.38])
          by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id AAA08474
          for <FreeBSD-gnats-submit@freebsd.org>; Sat, 3 Aug 1996 00:49:51 -0700 (PDT)
Received: (from obrien@localhost) by relay.nuxi.com (8.7.5/8.6.12) id AAA01977; Sat, 3 Aug 1996 00:50:07 -0700 (PDT)
Message-Id: <199608030750.AAA01977@relay.nuxi.com>
Date: Sat, 3 Aug 1996 00:50:07 -0700 (PDT)
From: "David E. O'Brien" <obrien@Nuxi.cs.ucdavis.edu>
Reply-To: obrien@Nuxi.cs.ucdavis.edu
To: FreeBSD-gnats-submit@freebsd.org
Cc: obrien@Nuxi.com
Subject: error messages lacking in /usr/bin/fetch
X-Send-Pr-Version: 3.2

>Number:         1459
>Category:       bin
>Synopsis:       error messages lacking in /usr/bin/fetch
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Aug  3 00:50:00 PDT 1996
>Closed-Date:    Fri Aug 9 01:27:03 PDT 1996
>Last-Modified:  Fri Aug  9 01:28:24 PDT 1996
>Originator:     David E. O'Brien
>Release:        FreeBSD 2.1.5-RELEASE i386
>Organization:
University of California, Davis
>Environment:

	/usr/bin/fetch from stock 2.1.5-RELEASE

>Description:

	Error messages in /usr/bin/fetch are sadly lacking.  Some are terse,
	and some are totally lacking.
	I was writing a Makefile for a port and kept getting "Permission
	denied" when doing ``make fetch''.  I could manually fetch and ncftp
	the dist file, but the distfile is weirdly named compaired to the
	PKGNAME.  I kept thinking I had a mis-typing in Makefile.  After an
	hour, I finally figured out that I didn't have write permission on
	the DISTDIR I was using.  A better error message would have pointed
	this out right away.

>How-To-Repeat:

	

>Fix:
	Patch to /usr/src/usr.bin/fetch/main.c	
	
--- main.c.orig	Wed Jul 17 19:55:52 1996
+++ main.c	Wed Jul 31 18:10:00 1996
@@ -224,7 +224,7 @@
 	    lp = "anonymous";
 	ftp = ftpLogin(host, lp, ftp_pw, 0);
 	if (!ftp) 
-	    err(1, "Couldn't open FTP connection to %s.", host);
+	    err(1, "Couldn't open FTP connection or login to %s.", host);
 
 	/* Time to set our defaults */
 	ftpBinary (ftp);
@@ -272,7 +272,7 @@
 	if (strcmp (outputfile, "-")) {
 		file = fopen (outputfile, size0 ? "a" : "w");
 		if (!file) 
-		    err (1, outputfile);
+		    err (1, "Could not open output file %s\n", outputfile);
 	} else 
 	    file = stdout;
 
@@ -477,7 +477,7 @@
 	sprintf (str, "GET /%s HTTP/1.0\n\n", file_to_get);
 	i = strlen (str);
 	if (i != write (s, str, i))
-	    err (1, 0);
+	    err (1, "Could not send GET command to HTTP server\n");
 
 	FD_ZERO (&fdset);
 	FD_SET (s, &fdset);
@@ -490,7 +490,7 @@
 	if (strcmp (outputfile, "-")) {
 		file = fopen (outputfile, "w");
 		if (!file)
-		    err (1, 0);
+		    err (1, "Could not open output file %s\n", outputfile);
 	} else {
 		file = stdout;
 		verbose = 0;
@@ -510,7 +510,7 @@
 			    exit (0);
 			break;
 		      default:
-			err (1, 0);
+			err (1, "Communication error with HTTP server\n");
 		}
 	}
 }
@@ -621,7 +621,7 @@
 	} else {
 		h = gethostbyname (host);
 		if (!h) 
-		    err (1, 0);
+		    err (1, "Could not lookup host %s\n", host);
 		sin.sin_family = h->h_addrtype;
 		bcopy(h->h_addr, (char *)&sin.sin_addr, h->h_length);
 	}
@@ -633,7 +633,7 @@
 	sin2.sin_port = 0;
 	sin2.sin_addr.s_addr = htonl (INADDR_ANY);
 	if (bind (s, (struct sockaddr *)&sin2, sizeof (sin2)))
-	    err (1, 0);
+	    err (1, "Could not bind to socket\n");
 
 	if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0)
 	    err (1, "Connection failed");

>Release-Note:
>Audit-Trail:

From: Garrett Wollman <wollman@lcs.mit.edu>
To: obrien@Nuxi.cs.ucdavis.edu
Cc: FreeBSD-gnats-submit@freebsd.org
Subject: bin/1459: error messages lacking in /usr/bin/fetch
Date: Mon, 5 Aug 1996 11:16:07 -0400

 <<On Sat, 3 Aug 1996 00:50:07 -0700 (PDT), "David E. O'Brien" <obrien@Nuxi.cs.ucdavis.edu> said:
 
 > +		    err (1, "Could not open output file %s\n", outputfile);
 
 Error messages should not be capitalized.
 
 Putting a newline on the end of a message makes it look stupid:
 
 fetch: Could not open output file foo
 : Permission denied
 
 -GAWollman
 
 --
 Garrett A. Wollman   | O Siem / We are all family / O Siem / We're all the same
 wollman@lcs.mit.edu  | O Siem / The fires of freedom 
 Opinions not those of| Dance in the burning flame
 MIT, LCS, ANA, or NSA|                     - Susan Aglukark and Chad Irschick
State-Changed-From-To: open->closed 
State-Changed-By: peter 
State-Changed-When: Fri Aug 9 01:27:03 PDT 1996 
State-Changed-Why:  
Fixes were applied in rev 1.11 of main.c, and adjusted in rev 1.13. 
>Unformatted:
