Path: csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail From: Eli Schwartz Newsgroups: gnu.bash.bug Subject: Re: An xtrace variant Date: Mon, 29 Jun 2020 11:49:17 -0400 Lines: 84 Approved: bug-bash@gnu.org Message-ID: References: <878sg61w0w.fsf@hobgoblin.ariadne.com> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="XmcG7Ph2EQ0jO0X02ALJx8oahCCeBRiAi" X-Trace: usenet.stanford.edu 1593445772 17547 209.51.188.17 (29 Jun 2020 15:49:32 GMT) X-Complaints-To: action@cs.stanford.edu Cc: bug-bash@gnu.org To: "Dale R. Worley" Envelope-to: bug-bash@gnu.org X-Spam-BL-Results: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=archlinux.org; s=orion; t=1593445762; bh=nTDi5Sw4uOX5bFMgluFwMi+wvOH1GTXt5o+vXxIjJbw=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=meOMeEHSpqu5R5/p4o6Dnc6dn2FCDBzRG4AFiA4QgodfF3ZDHzEC+Z3AldBG4omwp 1L4pyQeVIqADIEoe7qSiH8nmkX2qYDsRFl4KMvryd4kDR4UAOCTjfihXb7y2FVI57y vHydBoDTbkLuoHbwn6KWt++Se2eKkSHA9JHlv6NeJZWvqaJtMy54GEDA+U3P336AD5 ALZnKq3JdA2XQ0vCgohIhaTvjGo5Jqscmn5WY1oJWyDdRsz1Zh+rKh+f+kRo8WqBEe ECjcl5SF2Cxa4Vldjc0tJp2zTsO5utMAxgfZ+Yowqlr3IUjnSLzVaYucM1Oz93fzRR mSfMptaYmDNogJ3rPqcpfa9XePh0UqPDsTbRnoWiDnyaHFI3FumUNDXcjo2Hd8Ky+E gPVOTpdc/5IARoNYuAz4SG+qWrkHEQoD5lKPgY/LOtWCCVP2jGPcz3grHm7rfwK6DE Qo+6Qo7iIj4WNF7IVmB2DSxoUWqEMjz2yXecanJ6+JTNmKu+kJlrmfeuYB4x1nAQnZ YaVMhqPwWocrE1ccicVsyCVEWvj+r5s7TTz+liBgazJ6k8EYvTuwcZhQau/6dOS20L r5Yr7LUwUkwYY9vDAZlkbOz7eRaP5yVDbEUTmPZa7oLIhZvFiz8pmk5Gl+WcdN5MPl idCo+hcFHm+KSWIOAjIyU/M4= X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 In-Reply-To: <878sg61w0w.fsf@hobgoblin.ariadne.com> Received-SPF: pass client-ip=88.198.91.70; envelope-from=eschwartz@archlinux.org; helo=orion.archlinux.org X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/29 11:49:23 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -53 X-Spam_score: -5.4 X-Spam_bar: ----- X-Spam_report: (-5.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: <878sg61w0w.fsf@hobgoblin.ariadne.com> Xref: csiph.com gnu.bash.bug:16493 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --XmcG7Ph2EQ0jO0X02ALJx8oahCCeBRiAi Content-Type: multipart/mixed; boundary="PSnt0RP0boC2YoUwLtToxn8CDmdQanO4v" --PSnt0RP0boC2YoUwLtToxn8CDmdQanO4v Content-Type: text/plain; charset=utf-8 Content-Language: en-US-large Content-Transfer-Encoding: quoted-printable On 6/28/20 9:49 PM, Dale R. Worley wrote: > Eli Schwartz writes: >> Why not just run bash -x script-name without the bash -l option and >> without $BASH_ENV set? >> >> The first is implicitly true based on your stated command line. The >> second doesn't seem like a high bar to set, and it's not exactly defau= lt >> behavior... if you really do need $BASH_ENV can't you do the set -x at= >> the end of that file? >=20 > That's a good point, and I admit I've never studied out all of the logi= c > of Bash init files; I assumed that it executed ~/.bashrc as a matter of= > course. >=20 > So as long as I don't need the facilities in .bashrc for the script, > then "BASH_ENV=3D bash ..." suffices. You DON'T have the facilities in .bashrc for scripts per default. If your script relies on it, then it shouldn't. If it still does rely on it, then it should manually source it to ensure it is actually available, or you should factor out significant code into a shell library= =2E While you're at it you could make a shell library that looks for $XTRACE and invokes 'set -x; unset XTRACE', which gets rid of the PITA you're worried about too, and lets you choose exactly where in the script you start debugging, so you can also skip preambles/lists of constants. --=20 Eli Schwartz Arch Linux Bug Wrangler and Trusted User --PSnt0RP0boC2YoUwLtToxn8CDmdQanO4v-- --XmcG7Ph2EQ0jO0X02ALJx8oahCCeBRiAi Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEvSewel70XCra9w4EhIGKaBmvSpsFAl76DX0ACgkQhIGKaBmv SpuX1hAAn128JAtLvGnktpakjjlR/Tt3CPicOgV9gWh9+s56ZhwzEs8uXr5VEQjy TilkDzaaRdKVmU3x1TOjk9GeerIKq3Q3qCBX7ynJMjH8cuSeubCSCrGQb4qBMN7D Hw/kCbnbBai0KzhF05Kj0i2lsdt1O5SqxOkLS1HTQuQMaDXkFRBoe7MNnfCJY86+ j7bV4J7m0xu6+sam9/nX3VQSKON+ecMxyr+RxWsymeBmzpf1AwDXIaLcoe/Vzvs+ L+CN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