misc/157499: fetch confused me with it's error message

Konstantin Malov Konstantin.Malov at kaspersky.com
Thu Jun 2 09:10:12 UTC 2011


The following reply was made to PR bin/157499; it has been noted by GNATS.

From: Konstantin Malov <Konstantin.Malov at kaspersky.com>
To: Jaakko Heinonen <jh at FreeBSD.org>
Cc: "bug-followup at FreeBSD.org" <bug-followup at 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 at FreeBSD.org]=20
 Sent: Thursday, June 02, 2011 12:01 PM
 To: Konstantin Malov
 Cc: bug-followup at 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 at 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


More information about the freebsd-bugs mailing list