From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 39889138334 for ; Sat, 5 Jan 2019 21:42:39 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id C39ECE0B2E; Sat, 5 Jan 2019 21:42:35 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 55D9EE0B17 for ; Sat, 5 Jan 2019 21:42:35 +0000 (UTC) Received: from pomiot (d202-252.icpnet.pl [109.173.202.252]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mgorny) by smtp.gentoo.org (Postfix) with ESMTPSA id 2A1A2335D1E; Sat, 5 Jan 2019 21:42:31 +0000 (UTC) Message-ID: <1546724547.1889.16.camel@gentoo.org> Subject: Re: [gentoo-dev] [PATCH 06/12] python-utils-r1.eclass: Don't die in python_fix_shebang if all fixed From: =?UTF-8?Q?Micha=C5=82_G=C3=B3rny?= To: gentoo-dev@lists.gentoo.org Date: Sat, 05 Jan 2019 22:42:27 +0100 In-Reply-To: <20190105213814.6e916a5d@symphony.aura-online.co.uk> References: <20190103213924.22835-1-chewi@gentoo.org> <20190103213924.22835-7-chewi@gentoo.org> <1546617317.1895.10.camel@gentoo.org> <1546626394.1895.14.camel@gentoo.org> <20190105213814.6e916a5d@symphony.aura-online.co.uk> Organization: Gentoo Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-crD5DXLhbP4pYs9ythkR" X-Mailer: Evolution 3.26.6 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 X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply Mime-Version: 1.0 X-Archives-Salt: 121da4fa-e5bc-4ca8-8535-44077b1371d1 X-Archives-Hash: 212c1c2dd571c7836fc8e072f351bef6 --=-crD5DXLhbP4pYs9ythkR Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, 2019-01-05 at 21:38 +0000, James Le Cuirot wrote: > On Fri, 04 Jan 2019 19:26:34 +0100 > Micha=C5=82 G=C3=B3rny wrote: >=20 > > On Fri, 2019-01-04 at 13:10 -0500, Mike Gilbert wrote: > > > On Fri, Jan 4, 2019 at 10:55 AM Micha=C5=82 G=C3=B3rny wrote: =20 > > > >=20 > > > > On Thu, 2019-01-03 at 21:39 +0000, James Le Cuirot wrote: =20 > > > > > Shebangs may need fixing on prefix systems or when cross-building= but > > > > > not at other times. > > > > >=20 > > > > > Signed-off-by: James Le Cuirot > > > > > --- > > > > > eclass/python-utils-r1.eclass | 8 ++------ > > > > > 1 file changed, 2 insertions(+), 6 deletions(-) > > > > >=20 > > > > > diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-= r1.eclass > > > > > index 19cfaf2798ab..91e457f3cf14 100644 > > > > > --- a/eclass/python-utils-r1.eclass > > > > > +++ b/eclass/python-utils-r1.eclass > > > > > @@ -1328,16 +1328,12 @@ python_fix_shebang() { > > > > > fi > > > > > done < <(find -H "${path}" -type f -print0 || die) > > > > >=20 > > > > > - if [[ ! ${any_fixed} ]]; then > > > > > + if [[ ! ${any_fixed} && ! ${any_correct} ]]; then > > > > > local cmd=3Deerror > > > > > [[ ${EAPI:-0} =3D=3D [012345] ]] && cmd=3De= qawarn > > > > >=20 > > > > > "${cmd}" "QA warning: ${FUNCNAME}, ${path#$= {D%/}} did not match any fixable files." > > > > > - if [[ ${any_correct} ]]; then > > > > > - "${cmd}" "All files have ${EPYTHON}= shebang already." > > > > > - else > > > > > - "${cmd}" "There are no Python files= in specified directory." > > > > > - fi > > > > > + "${cmd}" "There are no Python files in spec= ified directory." > > > > >=20 > > > > > [[ ${cmd} =3D=3D eerror ]] && die "${FUNCNA= ME} did not match any fixable files (QA warning fatal in EAPI ${EAPI})" > > > > > fi =20 > > > >=20 > > > > Sounds like you're introducing breakage, then abusing a function to= fix > > > > your breakage, then killing a useful diagnostic because you've just > > > > broken it. =20 > > >=20 > > > I'm unable to make sense of what you are trying to say here. Is there > > > something wrong with this patch, or are you making a general comment > > > on the patch series? > > > =20 > >=20 > > Original usage: rewrite 'python' to 'pythonX.Y', etc. on static files.= =20 > > Throws an error if you try to use for files that have correct shebang > > already. > >=20 > > Now: > >=20 > > 1. Due to PYTHON override, generated files frequently have wrong > > shebangs. > >=20 > > 2. python_fix_shebang is modified to fix this -- orthogonal behavior is > > introduced. > >=20 > > 3. Now diagnostic on files with correct shebang is gone because it > > conflicts with the orthogonal behavior added here. >=20 > The diagnostic is a problem even without my changes. >=20 > It's quite likely upstream could hardcode a shebang like > #!/usr/bin/python2.7, which does not need to be modified on normal > systems but does on prefixed systems.=20 Fixing prefix was never the goal. >=20 > What about hardcoding #!/usr/bin/python3.6? This would need correcting > against 3.7 but would fall foul of the diagnostic when using 3.6. No, it would fail as mismatched shebang. By design. python_fix_shebang is meant to fix common cases of generic shebangs in a safe way, not serve as a generic shebang replacement tool. --=20 Best regards, Micha=C5=82 G=C3=B3rny --=-crD5DXLhbP4pYs9ythkR Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iQKTBAABCgB9FiEEXr8g+Zb7PCLMb8pAur8dX/jIEQoFAlwxJMRfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDVF QkYyMEY5OTZGQjNDMjJDQzZGQ0E0MEJBQkYxRDVGRjhDODExMEEACgkQur8dX/jI EQqSzQ//SnwaRZhP2+u7FCa97MqjJNpCq8Ohpv05HeGOP0BnYPq52CThMp0WmNHE VnpQcH/hEKR1JLasEJOllMAU63GstX5zzT7T3psP8ldVronrkr/xRFQp9NVNcNtm XjlSa/U9u4nXZx3kjM6Tgh6HVwvYZV+R7FT66/apCjQUVoxaOm3VU1tXx6WNbOjT w1SEuO37qhSlDAyNjKmUHpPBqKAGTmu9WgDqZws+GYCc1n1P0Ue2FFfL74XR2LjR NWSA0ucVzZxvqNsdUASE5HoIX0b1xCe2EnVvYUANVSg0zDfI+SSSr0PtZfSKwbQB 8g27/q+WdVxm9ijJtgENXFRiB1Ccn0Qj7L2YVJo/0/rMwu/OP04+snQWt2OqsjFh HSbhmMLk1oKnS/rIGY2LQf6x0iw0MyZJ5lyJVTN6ePvR1wspP5wHIhDo230tsqEH JN9uOvIaz/Yw+ADsgHhznPdTJEVAIjd7VZE017yFX/sKg5nyrZUSFk9UaF6Gt/vG DbDLk54NHuPhD+GdHS7b7Kmv4QB/ILTiOoYY43E8xRXAt8nz8R97MfOc6Zz8cZ3a y9T+ktzvpYGXNrNpamctjpY4e9S7lPO0F82ycy8unB9LiOvi2JKnhY6RptYBqsi2 9WPf7aK2mvxJDdHbEYb3P/ShNA2V7faNouYBdyt1t1Ji0kOjwGc= =6LP4 -----END PGP SIGNATURE----- --=-crD5DXLhbP4pYs9ythkR--