Re: [gentoo-portage-dev] [PATCH] Use env to find python
On Wed, 2020-06-17 at 10:18 +0200, Ulrich Mueller wrote: > > > > > > On Tue, 16 Jun 2020, Michał Górny wrote: > > '/usr/bin/env python' (with no extra options) is the portable shebang. > > I still think this is a gross hack. You want your script to use the > correct interpreter (which is in /usr/bin, or the path substituted for > it at install time), not some random binary which happens to be found > in the user's ${PATH}. > How do you presume what the correct interpreter is, and why do you presume that users put 'random binaries' in their PATH? What if the user needs to override 'correct interpreter'? Requiring people to overwrite executables in /usr/bin sounds like a 'gross hack'. -- Best regards, Michał Górny signature.asc Description: This is a digitally signed message part
Re: [gentoo-portage-dev] [PATCH] Use env to find python
> On Tue, 16 Jun 2020, Michał Górny wrote: > '/usr/bin/env python' (with no extra options) is the portable shebang. I still think this is a gross hack. You want your script to use the correct interpreter (which is in /usr/bin, or the path substituted for it at install time), not some random binary which happens to be found in the user's ${PATH}. Ulrich signature.asc Description: PGP signature
Re: [gentoo-portage-dev] [PATCH] Use env to find python
On 16-06-2020 23:10:28 -0500, Sid Spry wrote: > On Tue, Jun 16, 2020, at 3:57 PM, Michał Górny wrote: > > '/usr/bin/env python' (with no extra options) is the portable shebang. > > > > I added `-S` to preserve the options passed via the shebang line. It seems > they can be left off, does anyone know otherwise? -S is not supported on some platforms. In any case, I think this patch is wrong. In the Prefix case, the shebangs are set during install, in the non-Prefix case I think there is machinery in place to replace the shebangs during install. It seems the problem is already solved, why do you need these shebangs changed? Thanks, Fabian -- Fabian Groffen Gentoo on a different level signature.asc Description: PGP signature
Re: [gentoo-portage-dev] [PATCH] Use env to find python
On Tue, Jun 16, 2020, at 3:57 PM, Michał Górny wrote: > On Tue, 2020-06-16 at 15:19 -0400, Mike Gilbert wrote: > > On Tue, Jun 16, 2020 at 1:55 PM Zac Medico wrote: > > > On 6/16/20 10:46 AM, Mike Gilbert wrote: > > > > On Tue, Jun 16, 2020 at 1:45 PM Mike Gilbert wrote: > > > > > On Mon, Jun 15, 2020 at 9:39 AM Sid Spry wrote: > > > > > > On Mon, Jun 15, 2020, at 2:36 AM, Ulrich Mueller wrote: > > > > > > > But we know that it is in /usr/bin, so why add yet another > > > > > > > indirection? > > > > > > > > > > > > > > Attachments: > > > > > > > * signature.asc > > > > > > > > > > > > Ah, sorry -- I forgot to note this here. If you wish to support > > > > > > prefix it is possible it may not be in /usr/bin. Granted I am not > > > > > > sure if the prefix stage3 I was using is old enough to be broken in > > > > > > some way, but adding this would prevent future breakage. > > > > > > > > > > The portage ebuild and the python distutils module already take care > > > > > of updating shebangs at install time. > > > > > > > > I suppose your patch might be useful if you are trying to run portage > > > > from a git checkout on a prefix system. > > > > > > > > > > So, given that the ebuild updates shebangs automatically, should't we > > > optimize the default shebangs to be as flexible as possible? > > > > Yes, that makes sense. > > > > However, we should test to make sure that distutils is smart enough to > > parse that "/usr/bin/env -S python" string and replace it with > > version-specific python shebang. > > > > '/usr/bin/env python' (with no extra options) is the portable shebang. > I added `-S` to preserve the options passed via the shebang line. It seems they can be left off, does anyone know otherwise?
Re: [gentoo-portage-dev] [PATCH] Use env to find python
On Tue, 2020-06-16 at 15:19 -0400, Mike Gilbert wrote: > On Tue, Jun 16, 2020 at 1:55 PM Zac Medico wrote: > > On 6/16/20 10:46 AM, Mike Gilbert wrote: > > > On Tue, Jun 16, 2020 at 1:45 PM Mike Gilbert wrote: > > > > On Mon, Jun 15, 2020 at 9:39 AM Sid Spry wrote: > > > > > On Mon, Jun 15, 2020, at 2:36 AM, Ulrich Mueller wrote: > > > > > > But we know that it is in /usr/bin, so why add yet another > > > > > > indirection? > > > > > > > > > > > > Attachments: > > > > > > * signature.asc > > > > > > > > > > Ah, sorry -- I forgot to note this here. If you wish to support > > > > > prefix it is possible it may not be in /usr/bin. Granted I am not > > > > > sure if the prefix stage3 I was using is old enough to be broken in > > > > > some way, but adding this would prevent future breakage. > > > > > > > > The portage ebuild and the python distutils module already take care > > > > of updating shebangs at install time. > > > > > > I suppose your patch might be useful if you are trying to run portage > > > from a git checkout on a prefix system. > > > > > > > So, given that the ebuild updates shebangs automatically, should't we > > optimize the default shebangs to be as flexible as possible? > > Yes, that makes sense. > > However, we should test to make sure that distutils is smart enough to > parse that "/usr/bin/env -S python" string and replace it with > version-specific python shebang. > '/usr/bin/env python' (with no extra options) is the portable shebang. -- Best regards, Michał Górny signature.asc Description: This is a digitally signed message part
Re: [gentoo-portage-dev] [PATCH] Use env to find python
On Tue, Jun 16, 2020 at 1:55 PM Zac Medico wrote: > > On 6/16/20 10:46 AM, Mike Gilbert wrote: > > On Tue, Jun 16, 2020 at 1:45 PM Mike Gilbert wrote: > >> > >> On Mon, Jun 15, 2020 at 9:39 AM Sid Spry wrote: > >>> > >>> On Mon, Jun 15, 2020, at 2:36 AM, Ulrich Mueller wrote: > But we know that it is in /usr/bin, so why add yet another indirection? > > Attachments: > * signature.asc > >>> > >>> Ah, sorry -- I forgot to note this here. If you wish to support prefix it > >>> is possible it may not be in /usr/bin. Granted I am not sure if the > >>> prefix stage3 I was using is old enough to be broken in some way, but > >>> adding this would prevent future breakage. > >> > >> The portage ebuild and the python distutils module already take care > >> of updating shebangs at install time. > > > > I suppose your patch might be useful if you are trying to run portage > > from a git checkout on a prefix system. > > > > So, given that the ebuild updates shebangs automatically, should't we > optimize the default shebangs to be as flexible as possible? Yes, that makes sense. However, we should test to make sure that distutils is smart enough to parse that "/usr/bin/env -S python" string and replace it with version-specific python shebang.
Re: [gentoo-portage-dev] [PATCH] Use env to find python
On 6/16/20 10:46 AM, Mike Gilbert wrote: > On Tue, Jun 16, 2020 at 1:45 PM Mike Gilbert wrote: >> >> On Mon, Jun 15, 2020 at 9:39 AM Sid Spry wrote: >>> >>> On Mon, Jun 15, 2020, at 2:36 AM, Ulrich Mueller wrote: But we know that it is in /usr/bin, so why add yet another indirection? Attachments: * signature.asc >>> >>> Ah, sorry -- I forgot to note this here. If you wish to support prefix it >>> is possible it may not be in /usr/bin. Granted I am not sure if the prefix >>> stage3 I was using is old enough to be broken in some way, but adding this >>> would prevent future breakage. >> >> The portage ebuild and the python distutils module already take care >> of updating shebangs at install time. > > I suppose your patch might be useful if you are trying to run portage > from a git checkout on a prefix system. > So, given that the ebuild updates shebangs automatically, should't we optimize the default shebangs to be as flexible as possible? -- Thanks, Zac signature.asc Description: OpenPGP digital signature
Re: [gentoo-portage-dev] [PATCH] Use env to find python
On Tue, Jun 16, 2020 at 1:45 PM Mike Gilbert wrote: > > On Mon, Jun 15, 2020 at 9:39 AM Sid Spry wrote: > > > > On Mon, Jun 15, 2020, at 2:36 AM, Ulrich Mueller wrote: > > > But we know that it is in /usr/bin, so why add yet another indirection? > > > > > > Attachments: > > > * signature.asc > > > > Ah, sorry -- I forgot to note this here. If you wish to support prefix it > > is possible it may not be in /usr/bin. Granted I am not sure if the prefix > > stage3 I was using is old enough to be broken in some way, but adding this > > would prevent future breakage. > > The portage ebuild and the python distutils module already take care > of updating shebangs at install time. I suppose your patch might be useful if you are trying to run portage from a git checkout on a prefix system.
Re: [gentoo-portage-dev] [PATCH] Use env to find python
On Mon, Jun 15, 2020 at 9:39 AM Sid Spry wrote: > > On Mon, Jun 15, 2020, at 2:36 AM, Ulrich Mueller wrote: > > But we know that it is in /usr/bin, so why add yet another indirection? > > > > Attachments: > > * signature.asc > > Ah, sorry -- I forgot to note this here. If you wish to support prefix it is > possible it may not be in /usr/bin. Granted I am not sure if the prefix > stage3 I was using is old enough to be broken in some way, but adding this > would prevent future breakage. The portage ebuild and the python distutils module already take care of updating shebangs at install time.
Re: [gentoo-portage-dev] [PATCH] Use env to find python
On Mon, Jun 15, 2020, at 2:36 AM, Ulrich Mueller wrote: > But we know that it is in /usr/bin, so why add yet another indirection? > > Attachments: > * signature.asc Ah, sorry -- I forgot to note this here. If you wish to support prefix it is possible it may not be in /usr/bin. Granted I am not sure if the prefix stage3 I was using is old enough to be broken in some way, but adding this would prevent future breakage. I understand your concern but are these really in a hot path? Whatever the scripts are doing will beat the time it takes to invoke env by orders of magnitude. I can run benchmarks if you'd like, would the tests serve as such?
Re: [gentoo-portage-dev] [PATCH] Use env to find python
But we know that it is in /usr/bin, so why add yet another indirection? signature.asc Description: PGP signature