From owner-freebsd-bugs@FreeBSD.ORG Thu Jun 2 09:10:11 2011 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D2F95106564A for ; Thu, 2 Jun 2011 09:10:11 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id B7C6E8FC0C for ; Thu, 2 Jun 2011 09:10:11 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p529ABUe005922 for ; Thu, 2 Jun 2011 09:10:11 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p529ABBK005921; Thu, 2 Jun 2011 09:10:11 GMT (envelope-from gnats) Date: Thu, 2 Jun 2011 09:10:11 GMT Message-Id: <201106020910.p529ABBK005921@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Konstantin Malov Cc: Subject: RE: misc/157499: fetch confused me with it's error message X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Konstantin Malov List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2011 09:10:12 -0000 The following reply was made to PR bin/157499; it has been noted by GNATS. From: Konstantin Malov To: Jaakko Heinonen Cc: "bug-followup@FreeBSD.org" Subject: RE: misc/157499: fetch confused me with it's error message Date: Thu, 2 Jun 2011 12:48:07 +0400 I agree with this. So real problem is that this error message 'Syntax error, command unrecogni= zed' appears with warnx function:=20 warnx("%s: %s", URL, fetchLastErrString);=20 There are three such places in fetch.c where warnx is used without addition= al information about error cause. I don't know what to add in this place:=20 402 /* set the protocol timeout. */ 403 fetchTimeout =3D timeout; 404 405 /* just print size */ 406 if (s_flag) { 407 if (timeout) 408 alarm(timeout); 409 r =3D fetchStat(url, &us, flags); 410 if (timeout) 411 alarm(0); 412 if (sigalrm || sigint) 413 goto signal; 414 if (r =3D=3D -1) { 415 warnx("%s", fetchLastErrString); 416 goto failure; 417 } 418 if (us.size =3D=3D -1) 419 printf("Unknown\n"); 420 else 421 printf("%jd\n", (intmax_t)us.size); 422 goto success; 423 } But for last two I can suggest this patch:=20 --- fetch.c.orig 2011-06-02 12:06:26.000000000 +0400 +++ fetch.c 2011-06-02 12:28:25.000000000 +0400 @@ -463,7 +463,7 @@ if (sigalrm || sigint) goto signal; if (f =3D=3D NULL) { - warnx("%s: %s", URL, fetchLastErrString); + warnx("data fetch from '%s' failed with error: %s", URL, fe= tchLastErrString); if (i_flag && strcmp(url->scheme, SCHEME_HTTP) =3D=3D 0 && fetchLastErrCode =3D=3D FETCH_OK && strcmp(fetchLastErrString, "Not Modified") =3D=3D 0)= { @@ -574,7 +574,7 @@ */ url->offset =3D 0; if ((f =3D fetchXGet(url, &us, flags)) =3D=3D NULL)= { - warnx("%s: %s", URL, fetchLastErrString); + warnx("data fetch from '%s' failed with err= or: %s", URL, fetchLastErrString); goto failure; } if (sigint) -----Original Message----- From: Jaakko Heinonen [mailto:jh@FreeBSD.org]=20 Sent: Thursday, June 02, 2011 12:01 PM To: Konstantin Malov Cc: bug-followup@FreeBSD.org Subject: Re: misc/157499: fetch confused me with it's error message On 2011-06-01, Konstantin wrote: > I have found out some strange error handling in /usr/bin/fetch. > Here it is:=20 >=20 > # fetch ftp://ftp.freebsd.org/pub/FreeBSD/ports/ports/ports.tar.gz > fetch: ftp://ftp.freebsd.org/pub/FreeBSD/ports/ports/ports.tar.gz: Syntax= error, command unrecognized > >>> USER anonymous > <<< 331 Please specify the password. > >>> PASS root@h-ksn-hkg-fe-2.kaspersky-labs.com > <<< 500 OOPS: cannot change directory:/home/ftp > fetch: ftp://ftp.freebsd.org/pub/FreeBSD/ports/ports/ports.tar.gz: Synta= x error, command unrecognized This is how reply code 500 is defined in RFC 959: 500 Syntax error, command unrecognized. This may include errors such as command line too long. --=20 Jaakko