From owner-freebsd-bugs Sat Aug 3 00:50:03 1996 Return-Path: owner-bugs Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id AAA08519 for bugs-outgoing; Sat, 3 Aug 1996 00:50:03 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id AAA08513; Sat, 3 Aug 1996 00:50:01 -0700 (PDT) Resent-Date: Sat, 3 Aug 1996 00:50:01 -0700 (PDT) Resent-Message-Id: <199608030750.AAA08513@freefall.freebsd.org> Resent-From: gnats (GNATS Management) Resent-To: freebsd-bugs Resent-Reply-To: FreeBSD-gnats@freefall.FreeBSD.org, obrien@Nuxi.cs.ucdavis.edu 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 ; 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" Reply-To: obrien@Nuxi.cs.ucdavis.edu To: FreeBSD-gnats-submit@freebsd.org Cc: obrien@Nuxi.com X-Send-Pr-Version: 3.2 Subject: bin/1459: error messages lacking in /usr/bin/fetch Sender: owner-bugs@freebsd.org X-Loop: FreeBSD.org Precedence: bulk >Number: 1459 >Category: bin >Synopsis: error messages lacking in /usr/bin/fetch >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Aug 3 00:50:00 PDT 1996 >Last-Modified: >Originator: David E. O'Brien >Organization: University of California, Davis >Release: FreeBSD 2.1.5-RELEASE i386 >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"); >Audit-Trail: >Unformatted: