Date: Sat, 3 Aug 1996 00:50:07 -0700 (PDT) From: "David E. O'Brien" <obrien@Nuxi.cs.ucdavis.edu> To: FreeBSD-gnats-submit@freebsd.org Cc: obrien@Nuxi.com Subject: bin/1459: error messages lacking in /usr/bin/fetch Message-ID: <199608030750.AAA01977@relay.nuxi.com> Resent-Message-ID: <199608030750.AAA08513@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199608030750.AAA01977>