Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 416131 - python-distutils-ng: distutils-installed scripts have random shebangs
Summary: python-distutils-ng: distutils-installed scripts have random shebangs
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Krzysztof Pawlik (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-15 18:19 UTC by Michał Górny
Modified: 2012-05-21 17:33 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
python-distutils-ng.eclass-auto-redo.patch (python-distutils-ng.eclass-auto-redo.patch,777 bytes, patch)
2012-05-15 19:19 UTC, Krzysztof Pawlik (RETIRED)
Details | Diff
python-distutils-ng.eclass-auto-redo.patch (python-distutils-ng.eclass-auto-redo.patch,647 bytes, patch)
2012-05-21 17:29 UTC, Krzysztof Pawlik (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2012-05-15 18:19:07 UTC
When a Python package is built for multiple Python ABIs, the scripts are installed from a random (last built?) ABI. This causes them to have fixed shebang at unusually old Python version (here 2.6). Seems like a design flaw.
Comment 1 Krzysztof Pawlik (RETIRED) gentoo-dev 2012-05-15 18:21:15 UTC
Ebuild?

PS. You're free to change the eclass too.
Comment 2 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2012-05-15 18:24:00 UTC
eclean-kernel. Not that I have an idea how to handle that :P.
Comment 3 Krzysztof Pawlik (RETIRED) gentoo-dev 2012-05-15 18:33:39 UTC
(In reply to comment #2)
> eclean-kernel. Not that I have an idea how to handle that :P.

No problem - I'll look into it, can you please:
 1. attach ebuild that uses p-d-ng.eclass
 2. ebuild eclean-kernel...eclass install && head -n 3 /var/tmp/portage/app-portage/eclean-kernel/image/usr/bin/*
Comment 4 Krzysztof Pawlik (RETIRED) gentoo-dev 2012-05-15 18:42:00 UTC
Ok - found it, you need to tell eclass that you want to install a script:

$ cvs diff eclean-kernel-0.3.ebuild 
Index: eclean-kernel-0.3.ebuild
===================================================================
RCS file: /var/cvsroot/gentoo-x86/app-admin/eclean-kernel/eclean-kernel-0.3.ebuild,v
retrieving revision 1.1
diff -u -r1.1 eclean-kernel-0.3.ebuild
--- eclean-kernel-0.3.ebuild    11 May 2012 17:35:25 -0000      1.1
+++ eclean-kernel-0.3.ebuild    15 May 2012 18:38:35 -0000
@@ -24,4 +24,5 @@
 
 python_install_all() {
        dodoc README
+       python-distutils-ng_redoscript "/usr/bin/${PN}"
 }


I wonder whenever we should do some auto-magic to scripts installed in {,/usr}/{,s}bin/ - opinion?
Comment 5 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2012-05-15 18:59:39 UTC
Ouch, that looks like another Python eclass... I'd really prefer just having a single binary with #!/usr/bin/env python...
Comment 6 Krzysztof Pawlik (RETIRED) gentoo-dev 2012-05-15 19:19:14 UTC
Created attachment 311893 [details, diff]
python-distutils-ng.eclass-auto-redo.patch

(In reply to comment #5)
> Ouch, that looks like another Python eclass... I'd really prefer just having
> a single binary with #!/usr/bin/env python...

Hm.. I like having separate scripts for each implementation. I don't think we can support both approaches at the same time without introducing a global variable that would be user controllable, but this is bad because users would end up with different results for same builds.

For now we can add this to eclass to automate this a little.
Comment 7 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2012-05-20 06:49:01 UTC
(In reply to comment #6)
> Created attachment 311893 [details, diff] [details, diff]
> python-distutils-ng.eclass-auto-redo.patch
> 
> (In reply to comment #5)
> > Ouch, that looks like another Python eclass... I'd really prefer just having
> > a single binary with #!/usr/bin/env python...
> 
> Hm.. I like having separate scripts for each implementation. I don't think
> we can support both approaches at the same time without introducing a global
> variable that would be user controllable, but this is bad because users
> would end up with different results for same builds.
> 
> For now we can add this to eclass to automate this a little.

Would be great.

You can, however, just pass all the paths and skip the checking part since you are doing 2>/dev/null anyway.
Comment 8 Krzysztof Pawlik (RETIRED) gentoo-dev 2012-05-21 17:29:00 UTC
Created attachment 312561 [details, diff]
python-distutils-ng.eclass-auto-redo.patch

Good point, I'm committing this version; the only change is what you've suggested.
Comment 9 Krzysztof Pawlik (RETIRED) gentoo-dev 2012-05-21 17:33:35 UTC
I've committed documentation too:

+# @ECLASS-VARIABLE: PYTHON_DISABLE_SCRIPT_REDOS
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Set to any value to disable automatic reinstallation of scripts in bin
+# directories. See python-distutils-ng_src_install function.