From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58422) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WimCX-0006ep-UB for qemu-devel@nongnu.org; Fri, 09 May 2014 10:55:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WimCS-0000XG-Sm for qemu-devel@nongnu.org; Fri, 09 May 2014 10:55:05 -0400 Received: from lputeaux-656-01-25-125.w80-12.abo.wanadoo.fr ([80.12.84.125]:60352 helo=paradis.irqsave.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WimCS-0000X4-MD for qemu-devel@nongnu.org; Fri, 09 May 2014 10:55:00 -0400 Date: Fri, 9 May 2014 16:55:31 +0200 From: =?iso-8859-1?Q?Beno=EEt?= Canet Message-ID: <20140509145530.GA19008@irqsave.net> References: <1399562319-26873-1-git-send-email-benoit.canet@irqsave.net> <87wqdwgm2e.fsf@blackfin.pond.sub.org> <20140508200455.GA28563@irqsave.net> <87a9arbjj4.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <87a9arbjj4.fsf@blackfin.pond.sub.org> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] qapi: Make the include directive idempotent. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: =?iso-8859-1?Q?Beno=EEt?= Canet , vilanova@ac.upc.edu, qemu-devel@nongnu.org, lcapitulino@redhat.com The Friday 09 May 2014 =E0 07:36:31 (+0200), Markus Armbruster wrote : > Beno=EEt Canet writes: >=20 > > The Thursday 08 May 2014 =E0 20:30:33 (+0200), Markus Armbruster wrot= e : > [...] > >> There are two reasons to detect cycles. The technical one is preven= ting > >> infinite expansion. No longer applies with idempotent include. The > >> other, more abstract one is rejecting nonsensical use of the include > >> directive. I think that one still applies. > [...] > >> > @@ -102,17 +102,16 @@ class QAPISchema: > >> > 'Expected a file name (st= ring), got: %s' > >> > % include) > >> > include_path =3D os.path.join(self.input_dir, inc= lude) > >> > - if any(include_path =3D=3D elem[1] > >> > - for elem in self.include_hist): > >> > - raise QAPIExprError(expr_info, "Inclusion loo= p for %s" > >> > - % include) > >> > + # make include idempotent by skipping further inc= ludes > >> > + if include_path in [x[1] for x in include_hist]: > >> > + continue > >>=20 > >> Loses cycle detection. > > > > It simply also skip cycle includes. If cycle are skipped then cannot = do no > > harm. >=20 > Your argument is based exclusively on the technical reason to detect > cycles: cycles need to be caught because they cause infinite recursion. > Since there is no infinite recursion with idempotent include, cycles ar= e > just fine. >=20 > I'm arguing from a more abstract point of view: cycles should be > rejected because they're nonsensical. The fact that they can cause > infinite recursion is an implementation detail. Even without infinite > recursion, they're just as nonsensical as ever. >=20 > [...] >=20 Ok. will redo it.