From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) by sourceware.org (Postfix) with ESMTP id A688E385DC01 for ; Mon, 31 Oct 2022 13:42:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A688E385DC01 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org Received: by smtp.gentoo.org (Postfix, from userid 559) id EB60F340FAB; Mon, 31 Oct 2022 13:42:34 +0000 (UTC) Date: Mon, 31 Oct 2022 18:13:13 +0545 From: Mike Frysinger To: Jon Turney Cc: newlib@sourceware.org Subject: Re: [PATCH] makedocbook: Fix false report of unhandled texinfo command Message-ID: Mail-Followup-To: Jon Turney , newlib@sourceware.org References: <20221031095914.2277-1-jon.turney@dronecode.org.uk> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="m5STRlk+S8xvwoBL" Content-Disposition: inline In-Reply-To: <20221031095914.2277-1-jon.turney@dronecode.org.uk> X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --m5STRlk+S8xvwoBL Content-Type: text/plain; charset=utf-8 Content-Disposition: inline On 31 Oct 2022 09:59, Jon Turney wrote: i guess the feedback below isn't exactly about new code even if it's relevant ... > + # fail if there are unhandled texinfo commands > + match = re.search('(? + if match: > + print("texinfo command '%s' remains in output" % match.group(), file=sys.stderr) this is a little dangerous in general as match.group() could return a tuple, and this would fail. if you want to use %, you should force a tuple. print("..." % (match.group(),), ...) > + exit(1) scripts should never use exit(), only sys.exit(). although i see the current script gets this wrong in a lot of places. also you can simplify this -- sys.exit accepts a string that it'll print to stderr and then exit non-zero. sys.exit(".....") -mike --m5STRlk+S8xvwoBL Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEuQK1JxMl+JKsJRrUQWM7n+g39YEFAmNfv10ACgkQQWM7n+g3 9YEyMA/+NDGIV1TmjSZvJMoF90jjMvZ4HLe9EWdw6xGnLNi0UBtdvARVYUlzMFIV 66eC1gmo0MclikIZ+6cniw1IsGbTWYPmR/kpxrOdPHUVOmARL3NO2czVEzr/9KOj onNG53SzgJZsWyg/b8MOLWuoAi57QVD/qKNMAPq2VP6Dna06z3ccLmaVp+DSiEvA S5RGxwkeccQ0yBUKN10vO02AIAjRV0ZRrZD6YiCebYwDn49yyrzFqkyiV5HkR5Yu H8WC8A1/eumKTDrgWqJByIasxUOwbcaP9BkzWC2BAoawihGnIUBuzFgFPL4oDzwW /aNKukKUshQ9qg6kgPbZNxedhYrH+FhxGC011LVoBv4NOKPMvrMyOPV9h1bDOYc9 nUXa0qP5HoHP7VDvcAbgR/5kDcZYlFV2JKSXsQH5gWj41oJtesoK+TR2Y+vJnajq of+QBr2xUnDfW6XNKMioSR9EBqXzF/SmewU02Ar9+vWGuapYrjBN710Kx7tyP/WI 4yD5swi/pt5eiTJWm7orgVS6OyFUhVLwaXPj5NQRqF5p94lxBYB06d4LAsW2SmFJ BWhnlq6JAzA4Svmxkabd5+DnD8pjItW+ZTi2zMIbKRTGcp9i1fFp3jxwtUwKdAG7 ufSfDsIAc98Hx6ZVUt5CIJEjEiKQ7FyLCA0915oEPLhE6WRrlZE= =inXn -----END PGP SIGNATURE----- --m5STRlk+S8xvwoBL--