From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wg0-x229.google.com (mail-wg0-x229.google.com [IPv6:2a00:1450:400c:c00::229]) by hurricane.the-brannons.com (Postfix) with ESMTPS id 39DB777DA9 for ; Tue, 22 Apr 2014 09:52:30 -0700 (PDT) Received: by mail-wg0-f41.google.com with SMTP id n12so4281944wgh.24 for ; Tue, 22 Apr 2014 09:52:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=BRHm/p7xbys725k60yXGh+39YrZIDHS97cXoJWKGhts=; b=EeHkejTqa7ZnK+QuN7Dp58ZaKkVpSqJvypqMPKTrCYjRVPV2HBjEOyM4AAHSh0gLcl FI+sOle0AoK32onLegB9jJ3bIGL0QgMZElY9utr6gpx4HueHUAy/KgtHHBg19qDoCLiI UaRfCuL1D+/AiZACJiSkIMq1wsPfENGvHEhrkbu4Q+QHIFGeaJcFlnMR4FNf98jmQsYn kN0Iwj6a92pnPzP1era3o+OItb+haXTrqBwBBjt8CkCmpVQ+rVUMO4cy5BcbMTJ1y0gS 06SOz5NkrJaQrfRnNfqjGMAAds8HevqjQb/MubIcL8tz2sRmHf6WRMvdMKxjRap+bkZw wBDw== X-Received: by 10.180.8.195 with SMTP id t3mr19709151wia.23.1398185528583; Tue, 22 Apr 2014 09:52:08 -0700 (PDT) Received: from toaster.adamthompson.me.uk (toaster.adamthompson.me.uk. [2001:8b0:1142:9042::2]) by mx.google.com with ESMTPSA id d6sm23669618wiz.4.2014.04.22.09.52.06 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 22 Apr 2014 09:52:07 -0700 (PDT) Date: Tue, 22 Apr 2014 17:52:04 +0100 From: Adam Thompson To: Karl Dahlke Message-ID: <20140422165204.GF23557@toaster.adamthompson.me.uk> References: <20140322123426.eklhad@comcast.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="oOB74oR0WcNeq9Zb" Content-Disposition: inline In-Reply-To: <20140322123426.eklhad@comcast.net> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: Edbrowse-dev@lists.the-brannons.com Subject: Re: [Edbrowse-dev] if then else X-BeenThere: edbrowse-dev@lists.the-brannons.com X-Mailman-Version: 2.1.17 Precedence: list List-Id: Edbrowse Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Apr 2014 16:52:30 -0000 --oOB74oR0WcNeq9Zb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Apr 22, 2014 at 12:34:26PM +0000, Karl Dahlke wrote: > Ok, my last push changed over 400 lines of code. > Really? > Yes, and all bug fixes; some serious, > serious enough to cause a segfault. Wow. > What happened? >=20 > My first mistake was in jsrt. > I didn't include any tests for the URL class. > That class is very special and very complicated, over a thousand lines of= code. > With no regression tests, bugs could creep in and nobody would know. > And they did. Ah. Are there any other missing tests from jsrt while we're here? > My latest push adds tests for this class, so this won't happen again. > See jsrt line 536. Good to hear, when I've not got large amounts of university work to do I'll= have a look. > I'm not going to describe all the bugs, but here is a funny one. > We had, for a long time, code like this: >=20 > if(condition) > do this > else > do that >=20 > But no error legs in js was leading to nulls and segfaults, > so we put in error legs all over the place. > This we needed to do, and thanks to everyone for your help. > There were so many, the process was rather mechanical, > and understandably so. > Just get er done. > Thus the above code became: >=20 > if(condition) > if(do this and it fails) { > js fail > return > } > else > if(do that and it fails) { > js fail > return > } >=20 > If you've studied formal language theory and compilers, > then you know this is the region of the C grammar that is ambiguous. > But the compiler doesn't tell you that, > it just picks a derivation and marches on. Yep. > Which one? > Not the one we expect. Yeah, it certainly isn't imediately obvious from reading the code what happ= ens=20 here,and I suspect I missed these when reviewing... sorry. > I changed the code as below and several bugs went away. >=20 > if(condition) { > if(do this and it fails) { > js fail > return > } > } else { > if(do that and it fails) { > js fail > return > } > } >=20 > There were quite a few blocks like this. Yeah I'm not surprised and well done for figuring out what the logic *shoul= d*=20 have been. > So there you go - bitten by the if else ambiguity of C. Yep and by the sounds of it quite badly. I'm now wondering if there are any other bugs of this type waiting to be=20 discovered. > There were other bugs too, dealing with string allocation > and a malformed url constructor. > I think they are fixed now; jsrt passes anyways. > I'm glad I cleaned all this up before release 3.5.1. So am I, again well done for fixing these. Cheers, Adam. --oOB74oR0WcNeq9Zb Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJTVp40AAoJELZ22lNQBzHOJBAH/1p37XhohAFK/Id+FfdKWZEb 5RZ4U6RaisR+GdvRPYLl+zGavdqWnQS1YfsDRkzoS6KfUm6LJXc586MBCTQBT9Om TM4H1CAaUZ42NhNXE1lr7qfepxb3FQby0I28K6Pcxk8keyhDk6AAELsGtZNBGkkK 3nOIrLYQFZQuNep1X7jJhbsngQCHEXKVc0OHV/ydrsft0CN6H905LSAovlRSGaEu QRDSyR8NmRMObQwtjIyUQW/rj6E9j+lB2ycjkgJNFwu/uITLBPZKMJbpcGmvH29+ PuOO7pXAQAFBf99Eltq309HiGh7WyKga5iSSPk64CbRet3dZn3iUDSLiU/cpHJc= =XaEr -----END PGP SIGNATURE----- --oOB74oR0WcNeq9Zb--