From owner-freebsd-arch Sat Mar 15 14:21:30 2003 Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7741037B401 for ; Sat, 15 Mar 2003 14:21:26 -0800 (PST) Received: from whale.sunbay.crimea.ua (whale.sunbay.crimea.ua [212.110.138.65]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8494F43FD7 for ; Sat, 15 Mar 2003 14:21:22 -0800 (PST) (envelope-from ru@whale.sunbay.crimea.ua) Received: from whale.sunbay.crimea.ua (ru@localhost [127.0.0.1]) by whale.sunbay.crimea.ua (8.12.8/8.12.8/Sunbay) with ESMTP id h2FMLGeK056478 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 16 Mar 2003 00:21:16 +0200 (EET) (envelope-from ru@whale.sunbay.crimea.ua) Received: (from ru@localhost) by whale.sunbay.crimea.ua (8.12.8/8.12.8/Submit) id h2FMLFbr056473; Sun, 16 Mar 2003 00:21:15 +0200 (EET) (envelope-from ru) Date: Sun, 16 Mar 2003 00:21:15 +0200 From: Ruslan Ermilov To: Marcel Moolenaar Cc: Alexander Leidinger , arch@FreeBSD.ORG Subject: Re: Bug in our make or undocumented feature? Message-ID: <20030315222115.GC54789@sunbay.com> References: <20030315165221.27d3d424.Alexander@Leidinger.net> <20030315192141.GA564@dhcp01.pn.xcllnt.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="0lnxQi9hkpPO77W3" Content-Disposition: inline In-Reply-To: <20030315192141.GA564@dhcp01.pn.xcllnt.net> User-Agent: Mutt/1.5.3i Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --0lnxQi9hkpPO77W3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Marcel, I will look into this patch some time later and let you know. Thanks for taking care of this. On Sat, Mar 15, 2003 at 11:21:41AM -0800, Marcel Moolenaar wrote: > On Sat, Mar 15, 2003 at 04:52:21PM +0100, Alexander Leidinger wrote: > > this part of a makefile doesn't work for me: > > ---snip--- > > WANTED_PORTS=3D shells/zsh lang/perl5 > >=20 > > mytarget: > > .for i in ${WANTED_PORTS} > > @echo "${i}" > > .if ${i} =3D=3D lang/perl5 =20 > > @echo "Yep, perl5." > > .endif > > .endfor > > ---snip--- >=20 > Bug. A simpler case: >=20 > .if "shells/zsh" =3D=3D "lang/perl5" > .endif >=20 > dhcp01% make -f mf > "mf", line 1: Malformed conditional ("shells/zsh" =3D=3D "lang/perl5") > "mf", line 1: Need an operator > "mf", line 2: if-less endif > "mf", line 2: Need an operator > make: fatal errors encountered -- cannot continue >=20 > The problem is that our make needs a variable on the left in order > to parse this correctly as a comparison. Now we end up evaluating this > like: > .if defined("shells/zsh") ... >=20 > The attached patches partly fixes it by allowing string comparisons > (ie make sure you have the lhs and rhs quoted) >=20 > Try it out, >=20 > --=20 > Marcel Moolenaar USPA: A-39004 marcel@xcllnt.net > Index: cond.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file: /home/ncvs/src/usr.bin/make/cond.c,v > retrieving revision 1.25 > diff -u -r1.25 cond.c > --- cond.c 23 Oct 2002 23:16:42 -0000 1.25 > +++ cond.c 15 Mar 2003 19:17:24 -0000 > @@ -500,6 +500,7 @@ > case '\0': > t =3D EndOfFile; > break; > + case '"': > case '$': { > char *lhs; > char *rhs; > @@ -511,16 +512,21 @@ > * Parse the variable spec and skip over it, saving its > * value in lhs. > */ > - t =3D Err; > - lhs =3D Var_Parse(condExpr, VAR_CMD, doEval,&varSpecLen,&doFree); > - if (lhs =3D=3D var_Error) { > - /* > - * Even if !doEval, we still report syntax errors, which > - * is what getting var_Error back with !doEval means. > - */ > - return(Err); > - } > - condExpr +=3D varSpecLen; > + if (*condExpr =3D=3D '$') { > + t =3D Err; > + lhs =3D Var_Parse(condExpr, VAR_CMD, doEval, &varSpecLen, > + &doFree); > + if (lhs =3D=3D var_Error) { > + /* > + * Even if !doEval, we still report syntax > + * errors, which is what getting var_Error > + * back with !doEval means. > + */ > + return(Err); > + } > + condExpr +=3D varSpecLen; > + } else > + lhs =3D NULL; > =20 > if (!isspace((unsigned char) *condExpr) && > strchr("!=3D><", *condExpr) =3D=3D NULL) { > @@ -529,8 +535,10 @@ > =20 > buf =3D Buf_Init(0); > =20 > - for (cp =3D lhs; *cp; cp++) > - Buf_AddByte(buf, (Byte)*cp); > + if (lhs !=3D NULL) { > + for (cp =3D lhs; *cp; cp++) > + Buf_AddByte(buf, (Byte)*cp); > + } > =20 > if (doFree) > free(lhs); > @@ -545,6 +553,9 @@ > =20 > doFree =3D TRUE; > } > + > + if (lhs =3D=3D NULL) > + return (Err); > =20 > /* > * Skip whitespace to get to the operator --=20 Ruslan Ermilov Sysadmin and DBA, ru@sunbay.com Sunbay Software AG, ru@FreeBSD.org FreeBSD committer, +380.652.512.251 Simferopol, Ukraine http://www.FreeBSD.org The Power To Serve http://www.oracle.com Enabling The Information Age --0lnxQi9hkpPO77W3 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (FreeBSD) iD8DBQE+c6dbUkv4P6juNwoRAnixAJ9dgK623qgZhAjMHEon0cNtKCnYtgCfQpJN SOVaZ8UTtT8LT++Fs4vh7Fw= =npMK -----END PGP SIGNATURE----- --0lnxQi9hkpPO77W3-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message