From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id A65FB1381F3 for ; Mon, 17 Jun 2013 16:06:40 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 74FE7E098A; Mon, 17 Jun 2013 16:06:35 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 85758E0964 for ; Mon, 17 Jun 2013 16:06:34 +0000 (UTC) Received: from vapier.localnet (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id B59A433E292 for ; Mon, 17 Jun 2013 16:06:33 +0000 (UTC) From: Mike Frysinger Organization: wh0rd.org To: gentoo-dev@lists.gentoo.org Subject: Re: [gentoo-dev] Re: evar_push/pop helpers Date: Mon, 17 Jun 2013 12:06:35 -0400 User-Agent: KMail/1.13.7 (Linux/3.8.3; KDE/4.6.5; x86_64; ; ) References: <201306012303.21261.vapier@gentoo.org> <20130602173804.GA4280@rathaus.eclipse.co.uk> <201306170142.15784.vapier@gentoo.org> In-Reply-To: <201306170142.15784.vapier@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1737727.callPsKxPS"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <201306171206.35913.vapier@gentoo.org> X-Archives-Salt: 406a757f-771c-4c25-a197-f9cbdfefce1f X-Archives-Hash: 6116513ecc98419fab2b8b7a023041a3 --nextPart1737727.callPsKxPS Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Monday 17 June 2013 01:42:15 Mike Frysinger wrote: > On Sunday 02 June 2013 13:38:04 Steven J. Long wrote: > > On Sat, Jun 01, 2013 at 11:03:20PM -0400, Mike Frysinger wrote: > > > +# is not specified, the var will be unset. > > > +evar_push_set() { > > > + local var=3D$1 > > > + evar_push ${var} > > > + case $# in > > > + 1) unset ${var} ;; > > > + 2) eval ${var}=3D\$2 ;; > >=20 > > I wish you wouldn't use eval for this. I know it's technically okay her= e, > > or would be if you verified the parameter, but bash has printf -v for > > this purpose: >=20 > interesting, i hadn't seen that before ... looks new to bash-3.1. /me > tucks that into his tool belt. >=20 > although it doesn't quite work in the edge case where the value is an emp= ty > string. consider: > unset x > printf -v x '' > echo ${x+set} >=20 > that should show "set", but it does not. i'll have to keep `eval ${var}= =3D` > when the value we're setting is empty. or just keep the eval code since i > have to do eval anyways at that point. >=20 > i'll report it upstream to the bash guys. looks like it can be worked around by doing: printf -v x '%s' '' which is arguably what we want anyways =2Dmike --nextPart1737727.callPsKxPS Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (GNU/Linux) iQIcBAABAgAGBQJRvzQLAAoJEEFjO5/oN/WBMCcP/Rau0oPgYChhbuwujy3qKq2y j6MFUogVYsK9HVN/wHClP1Cu9L9TDDLPiEMdEPOhXkiVNmJfv0IE/1qhwhnvCbk2 tvdLMHtveL1Fqrkr20bNpB/OQASHKmu0FWrUIH9lZpAEQ6+uKhLfrFiKg5JzUHr8 K2SbLOrAdkunz5NvgsZFnR+Uen3AYehYvh279AH1X5gsrF8SCGh/OgedvDJPiyL6 LhcF88vR6yvz6VhLVSsEM7yUmzB3XcNftLjpiD1DOYvLC+1iCL+j0DgvtPLXBciR 5XbGvKnX37PsETQd39twGM9n318qs46RGs6UBGORibIY0Qd6QrsddQnDHx8HP4iD A0iR4OJBIDBa0F6zLABZAqSdgOfdDWhIqNY9PccEksQtgaE9bz/K3RFkS5OkRBQc RyOOVrUPWPKjoLaj8wMU9UPk2YB/dPdU2d/NzqGqXiDeEgJi1sZNwftBZncVNRdc AQNkmCooQHelYx92cF3SYY/QVaotYIp2JN04XyNXg2BuNtrirJAxhiEAzrQWGUUE CTACJFfspQi9gJDjPJ1L3h6cYRFnH6vHfqoatXjuOF68tSdWgceDtXB+8HPMLMbd G9MbY+jutA3SV/wcy9+LrHXv2b1uNIUm9Z+Ar18MKce3K8rJwvkRcdbrNzFPSTV7 QGWqyMFq8vZgmhSwPcvP =baw+ -----END PGP SIGNATURE----- --nextPart1737727.callPsKxPS--