From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mimir.eigenstate.org ([206.124.132.107]) by ewsd; Sun Aug 2 00:35:21 EDT 2020 Received: from abbatoir.fios-router.home (pool-74-101-2-6.nycmny.fios.verizon.net [74.101.2.6]) by mimir.eigenstate.org (OpenSMTPD) with ESMTPSA id 32557dbf (TLSv1.2:ECDHE-RSA-AES256-SHA:256:NO) for <9front@9front.org>; Sat, 1 Aug 2020 21:35:12 -0700 (PDT) Message-ID: To: 9front@9front.org Subject: Re: [9front] Patch to fix test(1) expression parsing Date: Sat, 01 Aug 2020 21:35:11 -0700 From: ori@eigenstate.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: cache template-scale component > Hi all, > > The following patch fixes test(1) to correctly parse its own > expression syntax whilst avoiding executing of filesystem operations > when these tests ought not to be performed due to short-circuiting. > > Previously, short-circuiting of -a and -o logical operators would > result in an incorrect parse. For example, the following invocations Generally looks good, will test tomorrow -- just a minor comment: > fail: > > term% test '(' 1 -gt 2 -a 1 -gt 1 ')' > test: ) expected > term% test '(' 2 -gt 1 -o 1 -gt 1 ')' > test: ) expected > > - r = e(); > + r = e(1); > /* > * nice idea but short-circuit -o and -a operators may have > * not consumed their right-hand sides. This comment seems outdated -- we can use the nice idea and error out appropriately now.