[opensuse-packaging] Re: [opensuse-factory] rpmlint 1.10 about to enter openSUSE Factory
On Mon, 9 Oct 2017, Dirk Müller wrote:
Hi, ... - env-script-interpreter: This is a new check that has a Badness of 9. The value is so low because it triggers tremendously often right now. Basically, for shell scripts installed with chmod +x in the typical binary directories like /usr/bin and the like, it is alerting when the script shebang starts with "#!.*env ". The intention here is to avoid the rpm-dependency logic add a file-depends on /usr/bin/env (which is useless) and have the *actual* interpreter added as dependency instead. So to silence the warning, something like
sed -i -e "1 s,#! */usr/bin/env python,#!/usr/bin/python2," %{buildroot}/%{_bindir}/*.py
is needed. This lets the rpm-dependency magic add a proper file-depends on /usr/bin/python2, pulling in python-base if it isn't installed already.
Huh, why not fix RPM instead? Richard. -- Richard Biener <rguenther@suse.de> SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)
On Tue, Oct 10, 2017 at 6:04 AM, Richard Biener <rguenther@suse.de> wrote:
On Mon, 9 Oct 2017, Dirk Müller wrote:
Hi, ... - env-script-interpreter: This is a new check that has a Badness of 9. The value is so low because it triggers tremendously often right now. Basically, for shell scripts installed with chmod +x in the typical binary directories like /usr/bin and the like, it is alerting when the script shebang starts with "#!.*env ". The intention here is to avoid the rpm-dependency logic add a file-depends on /usr/bin/env (which is useless) and have the *actual* interpreter added as dependency instead. So to silence the warning, something like
sed -i -e "1 s,#! */usr/bin/env python,#!/usr/bin/python2," %{buildroot}/%{_bindir}/*.py
is needed. This lets the rpm-dependency magic add a proper file-depends on /usr/bin/python2, pulling in python-base if it isn't installed already.
Huh, why not fix RPM instead?
Funny you should mention that... It's been listed as a TODO for 8 years in the dependency generator[1]. It would also probably make sense to have an upstream brp that would rewrite those shebangs to the correct ones, since you always want it using the interpreter managed by package management. [1]: https://github.com/rpm-software-management/rpm/blob/master/scripts/script.re... -- 真実はいつも一つ!/ Always, there's only one truth! -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
On 10.10.2017 12:04, Richard Biener wrote:
On Mon, 9 Oct 2017, Dirk Müller wrote:
Hi, ... - env-script-interpreter: This is a new check that has a Badness of 9. The value is so low because it triggers tremendously often right now. Basically, for shell scripts installed with chmod +x in the typical binary directories like /usr/bin and the like, it is alerting when the script shebang starts with "#!.*env ". The intention here is to avoid the rpm-dependency logic add a file-depends on /usr/bin/env (which is useless) and have the *actual* interpreter added as dependency instead. So to silence the warning, something like
sed -i -e "1 s,#! */usr/bin/env python,#!/usr/bin/python2," %{buildroot}/%{_bindir}/*.py
is needed. This lets the rpm-dependency magic add a proper file-depends on /usr/bin/python2, pulling in python-base if it isn't installed already.
Huh, why not fix RPM instead?
In addition to what Neal said: using `#!/usr/bin/env` is a bug in almost all cases. It means that a distro-provided script runs on an unspecified interpreter randomly found in user's $PATH. The RPM behavior re dependencies is a minor bug; the buggy script is a bigger problem. To fix it, we would need a brp or some other mechanism to rewrite the actual installed scripts. regards m.
Richard.
-- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
Hi Richard, 2017-10-10 12:04 GMT+02:00 Richard Biener <rguenther@suse.de>:
is needed. This lets the rpm-dependency magic add a proper file-depends on /usr/bin/python2, pulling in python-base if it isn't installed already. Huh, why not fix RPM instead?
What would the fix look like? I know artificial intelligence is at the peak of the hype cycle right now, but I haven't seen support for it added to rpm yet ;-) The only "valid" solution would be to suppress a auto-depends on /usr/bin/env, which is sort of wrong as well (because if a script really uses it, it needs to be there so the dependency is correct). And for the 2nd parameter: env evaluates your $PATH, so there is no way for rpm to figure out which interpreter you meant because it doesn"t know the setting of $PATH at the time the script got executed. and it would be just as bad it "guessing" wrong than not guessing at all. Greetings, Dirk -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
participants (4)
-
Dirk Müller
-
jan matejek
-
Neal Gompa
-
Richard Biener