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 9233313825A for ; Sun, 15 May 2016 19:41:57 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B21831423C; Sun, 15 May 2016 19:41:50 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id AF18C21C01D for ; Sun, 15 May 2016 19:41:49 +0000 (UTC) Received: from pomiot (d202-252.icpnet.pl [109.173.202.252]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: mgorny) by smtp.gentoo.org (Postfix) with ESMTPSA id 4D376340BCD; Sun, 15 May 2016 19:41:47 +0000 (UTC) Date: Sun, 15 May 2016 21:41:41 +0200 From: =?UTF-8?B?TWljaGHFgiBHw7Nybnk=?= To: rindeal Cc: gentoo-dev@lists.gentoo.org Subject: Re: [gentoo-dev] [PATCH] flag-o-matic.eclass: bugfix for get-flag() Message-ID: <20160515214141.4dcc36f5.mgorny@gentoo.org> In-Reply-To: References: <1463319089-18877-1-git-send-email-dev.rindeal@gmail.com> <65DB30FD-2B31-45B6-B34D-021544C0E9D6@gentoo.org> Organization: Gentoo X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) 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; micalg=pgp-sha512; boundary="Sig_/JWsf+THE5l8=+XYG=Yim7Gd"; protocol="application/pgp-signature" X-Archives-Salt: 3ebc92e7-3f31-4663-8375-50c296d94d85 X-Archives-Hash: 72ca9bd583aded3b4cc71048e0cba8fb --Sig_/JWsf+THE5l8=+XYG=Yim7Gd Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Sun, 15 May 2016 21:35:41 +0200 rindeal wrote: > > Dnia 15 maja 2016 15:31:29 CEST, Jan Chren napi= sa=C5=82(a): =20 > >>+ local f=3D"${!i}" > >>+ if [ "${f#-${findflag#-}}" !=3D "${f}" ] ; then = =20 > > > > I know the original code sucked as well but could you replace this with= more readable [[ ${f} =3D=3D -${findflag#-}* ]] or alike (note: not tested= ). =20 >=20 > This is just as buggy as my original implementation, I've reworked it > and thanks to the tests I hope it's now correct. It is still unreadable. The point is, we use bash here, so please use bash features (i.e. =3D=3D with wildcards) to do comparison rather than limited shell-style stripping of variables. > >>+ printf "%s\n" "${f#-${findflag}=3D}" =20 > > > > It may be a good idea to add a short explanation why you can't use echo= here, as a comment. =20 >=20 > I've just copied what was there before, `echo` in bash is notoriously > wild, but with this simple string I guess it's ok, so done. I meant you should add a comment that you can't use echo because flags like '-n' or '-e' would confuse it :-P. --=20 Best regards, Micha=C5=82 G=C3=B3rny --Sig_/JWsf+THE5l8=+XYG=Yim7Gd Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQJ8BAEBCgBmBQJXOND2XxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQ2REJCMDdDQzRGMERBRDA2RUEwQUZFNDFC MDdBMUFFQUVGQjQ0NjRFAAoJELB6GurvtEZOZqkQAMO8XxGgCh826jRdDJZh7ILV BshMiAdISPHQfnhgzd7E7Xkfbe5ENeLFte6ta4hdaUOg04tZfjQHE/HYYxKGHUKd YJOhyeYeSI0irkbDZ2qUucpT6YGQbnNotY0SQai9C3SjtuOPItjFMqS8RdLryDba srjxZvbc4fziSIp113pWallQpJ85XStwpCfIZYjBoFYu10ag6NTPm6fNZ7Y1hT0S 4/i9Y9Q2hjXitQHWdAJl9HRNVYnjGv7C5Lu4kc0AXd/xD6ba1rQeGtDt6zHqqhaI UUqm+WAoP66geOm1qi9wD6ItcpoM3bfXSrBwmyoLSpXerW/JsJfzIEBmAkPjGscc OpUTVXpFF7zEKer689sr6MKNfgxJTGcMLfN/WwJJbLE91xTLURbj2OI680w7ESN7 ZXVmoWFyL0Ez09Iw4ks3NmHx9Eibp337rriYylKppMw1ige9XaejblKMspsbyt5G nlG8FWnwc9Ei7xVVmyy6567Crdc94xIz1IWC+HQrH0eTfk4hf34teMGrh5fSSz5V TEqit5xMHWs2qyxwzlXe7MEYZGEp9SN9KwvWQTi5ZDf8huvG+sEPJ3B3AVzPXVtM mBHv6N1kxMFgQxa13J6QpLWshbJjm1nWUu6iVjJLKhBna7h1bdb9AwiagEyM7uu7 yPIB9T3ZoHs3Nob3SnEK =lax7 -----END PGP SIGNATURE----- --Sig_/JWsf+THE5l8=+XYG=Yim7Gd--