Bug 1212476 - patch shebang line match the python version required in the package
Summary: patch shebang line match the python version required in the package
Status: REOPENED
Alias: None
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: Python (show other bugs)
Version: Current
Hardware: Other Other
: P5 - None : Normal (vote)
Target Milestone: ---
Assignee: Daniel Garcia
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-06-17 15:56 UTC by Marcus Rückert
Modified: 2024-07-16 15:41 UTC (History)
2 users (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marcus Rückert 2023-06-17 15:56:30 UTC
rpm -q --requires lutris | grep 'python(abi)'
python(abi) = 3.10

but the shebang line is /usr/bin/python3

with python3 defaulting to python3.11
this leaves the user with a non working package.

=> patch shebangline to ensure that the package matches.

This affected more packages. lutris is just an example.
Comment 1 Daniel Garcia 2023-06-19 08:14:12 UTC
That should be a problem of having different versions of packages during the change from python3.10 to python3.11.

I've checked the latest build and looks okay:

$ rpm -q --requires /home/danigm/.cache/zypp/packages/download.opensuse.org-oss_2/noarch/lutris-0.5.13-1.2.noarch.rpm | grep 'python(abi)'
python(abi) = 3.11
Comment 2 Marcus Rückert 2023-06-19 11:38:38 UTC
I explicitely said this is _not_ about fixing this _one_ package. if a package requires python(abi) = 3.11 thant he shebang line should probably affect that to make upgrading python versions not break things without need.

and the most simple way to achieve that is patched shebang lines.
Comment 3 Marcus Rückert 2023-06-19 11:53:21 UTC
rubygems e.g. injects the versioned shebang lines into the scripts installed into /usr/bin. so this automatically makes it work properly. I hope we can adapt setuptools/distutils/wheel to do something similar and we do not have to patch the shebang line manually in each package.

or if we need a per package solution, then it should be a macro.
Comment 4 Daniel Garcia 2023-06-19 12:32:35 UTC
This is done automatically in python-rpm-macros when using the %python_clone macro [1], and recently was also added to the %pyproject_install [2].

And by default, this is something that is done by setuptools, and other modern python packaging tools [3]. In modern python packages the "binaries" are created during package creation/installation and the shebang line is added there.

It's true that there are a lot of packages that does the shebang replacement manually, because of legacy code or other reasons, but there are tools now to fix this kind of issues in the python ecosystem and also in openSUSE python macros.

[1] https://github.com/openSUSE/python-rpm-macros/blob/master/macros.lua#L500
[2] https://github.com/openSUSE/python-rpm-macros/commit/1b898fb6fdbb20408ac153ac7217c9b658d7ec69 
[3] https://setuptools.pypa.io/en/latest/userguide/entry_point.html
Comment 5 Marcus Rückert 2023-06-19 15:39:21 UTC
so we should add an rpmlint check for this?
Comment 7 OBSbugzilla Bot 2024-02-23 17:35:03 UTC
This is an autogenerated message for OBS integration:
This bug (1212476) was mentioned in
https://build.opensuse.org/request/show/1149982 Factory / vulkan-headers
Comment 8 OBSbugzilla Bot 2024-02-26 11:35:03 UTC
This is an autogenerated message for OBS integration:
This bug (1212476) was mentioned in
https://build.opensuse.org/request/show/1150776 Factory / units
Comment 9 OBSbugzilla Bot 2024-03-12 13:35:02 UTC
This is an autogenerated message for OBS integration:
This bug (1212476) was mentioned in
https://build.opensuse.org/request/show/1157172 Factory / jgmenu
https://build.opensuse.org/request/show/1157173 Factory / sgtk-menu
Comment 10 OBSbugzilla Bot 2024-03-14 15:35:01 UTC
This is an autogenerated message for OBS integration:
This bug (1212476) was mentioned in
https://build.opensuse.org/request/show/1158006 Tools / osc
Comment 11 OBSbugzilla Bot 2024-03-14 17:35:02 UTC
This is an autogenerated message for OBS integration:
This bug (1212476) was mentioned in
https://build.opensuse.org/request/show/1158031 Factory / pacemaker
Comment 12 OBSbugzilla Bot 2024-03-21 15:35:03 UTC
This is an autogenerated message for OBS integration:
This bug (1212476) was mentioned in
https://build.opensuse.org/request/show/1160115 Factory / osc
Comment 13 OBSbugzilla Bot 2024-04-11 08:55:02 UTC
This is an autogenerated message for OBS integration:
This bug (1212476) was mentioned in
https://build.opensuse.org/request/show/1166785 Factory / gupnp
https://build.opensuse.org/request/show/1166786 Factory / libglade2
Comment 14 OBSbugzilla Bot 2024-04-11 12:45:02 UTC
This is an autogenerated message for OBS integration:
This bug (1212476) was mentioned in
https://build.opensuse.org/request/show/1166865 Factory / itstool
Comment 15 OBSbugzilla Bot 2024-04-14 13:25:02 UTC
This is an autogenerated message for OBS integration:
This bug (1212476) was mentioned in
https://build.opensuse.org/request/show/1167656 Factory / lirc
Comment 16 OBSbugzilla Bot 2024-04-29 10:05:01 UTC
This is an autogenerated message for OBS integration:
This bug (1212476) was mentioned in
https://build.opensuse.org/request/show/1170718 Factory / gtk2
https://build.opensuse.org/request/show/1170719 Factory / gtk-doc
Comment 17 OBSbugzilla Bot 2024-04-29 15:45:04 UTC
This is an autogenerated message for OBS integration:
This bug (1212476) was mentioned in
https://build.opensuse.org/request/show/1170823 Factory / gnome-tweaks
https://build.opensuse.org/request/show/1170824 Factory / gnome-shell
https://build.opensuse.org/request/show/1170825 Factory / gnome-music
Comment 18 OBSbugzilla Bot 2024-05-13 12:45:02 UTC
This is an autogenerated message for OBS integration:
This bug (1212476) was mentioned in
https://build.opensuse.org/request/show/1173646 15.6 / opensuse-welcome
Comment 19 OBSbugzilla Bot 2024-06-01 15:35:02 UTC
This is an autogenerated message for OBS integration:
This bug (1212476) was mentioned in
https://build.opensuse.org/request/show/1178065 Factory / git
Comment 20 OBSbugzilla Bot 2024-06-03 20:15:03 UTC
This is an autogenerated message for OBS integration:
This bug (1212476) was mentioned in
https://build.opensuse.org/request/show/1178380 Factory / epy
Comment 21 OBSbugzilla Bot 2024-06-11 14:45:03 UTC
This is an autogenerated message for OBS integration:
This bug (1212476) was mentioned in
https://build.opensuse.org/request/show/1180024 Backports:SLE-15-SP6 / opi
Comment 22 OBSbugzilla Bot 2024-06-13 09:35:02 UTC
This is an autogenerated message for OBS integration:
This bug (1212476) was mentioned in
https://build.opensuse.org/request/show/1180338 Factory / asymptote
Comment 23 OBSbugzilla Bot 2024-06-13 15:15:15 UTC
This is an autogenerated message for OBS integration:
This bug (1212476) was mentioned in
https://build.opensuse.org/request/show/1180707 Factory / munin
Comment 24 OBSbugzilla Bot 2024-06-14 14:35:03 UTC
This is an autogenerated message for OBS integration:
This bug (1212476) was mentioned in
https://build.opensuse.org/request/show/1180932 Factory / fwupd
Comment 25 OBSbugzilla Bot 2024-06-14 19:35:03 UTC
This is an autogenerated message for OBS integration:
This bug (1212476) was mentioned in
https://build.opensuse.org/request/show/1180968 Tools / obs-service-set_version
https://build.opensuse.org/request/show/1180973 Tools / obs-service-tar_scm
Comment 26 OBSbugzilla Bot 2024-06-18 16:05:16 UTC
This is an autogenerated message for OBS integration:
This bug (1212476) was mentioned in
https://build.opensuse.org/request/show/1181535 Factory / obs-service-set_version
Comment 27 OBSbugzilla Bot 2024-06-20 08:35:03 UTC
This is an autogenerated message for OBS integration:
This bug (1212476) was mentioned in
https://build.opensuse.org/request/show/1181880 Factory / obs-service-set_version
Comment 28 OBSbugzilla Bot 2024-06-20 11:55:01 UTC
This is an autogenerated message for OBS integration:
This bug (1212476) was mentioned in
https://build.opensuse.org/request/show/1181908 Factory / dwarves
Comment 29 Enzo Matsumiya 2024-06-20 19:02:07 UTC
This is breaking some of our SLE-15-SP4 builds:

https://build.opensuse.org/package/live_build_log/network:samba:STABLE/cifs-utils/SUSE_SLE-15-SP4_GA/x86_64

(same for network:samba:STABLE/ads)

Error message is:
> [   29s] + %python3_fix_shebang
> [   29s] /var/tmp/rpm-tmp.mQs0QZ: line 69: fg: no job control

Any ideas how to fix?  Or should we just remove it for this specific product?
Comment 30 Matej Cepl 2024-06-21 11:51:52 UTC
(In reply to Enzo Matsumiya from comment #29)
> Any ideas how to fix?  Or should we just remove it for this specific product?

https://build.suse.de/request/show/336291
Comment 33 OBSbugzilla Bot 2024-07-04 07:55:01 UTC
This is an autogenerated message for OBS integration:
This bug (1212476) was mentioned in
https://build.opensuse.org/request/show/1185296 Factory / texlive-specs-a
https://build.opensuse.org/request/show/1185297 Factory / texlive-specs-b
https://build.opensuse.org/request/show/1185298 Factory / texlive-specs-c
https://build.opensuse.org/request/show/1185299 Factory / texlive-specs-d
https://build.opensuse.org/request/show/1185300 Factory / texlive-specs-e
https://build.opensuse.org/request/show/1185301 Factory / texlive-specs-f
https://build.opensuse.org/request/show/1185302 Factory / texlive-specs-g
https://build.opensuse.org/request/show/1185303 Factory / texlive-specs-h
https://build.opensuse.org/request/show/1185304 Factory / texlive-specs-i
https://build.opensuse.org/request/show/1185305 Factory / texlive-specs-j
https://build.opensuse.org/request/show/1185306 Factory / texlive-specs-k
https://build.opensuse.org/request/show/1185307 Factory / texlive-specs-l
https://build.opensuse.org/request/show/1185308 Factory / texlive-specs-m
https://build.opensuse.org/request/show/1185309 Factory / texlive-specs-n
https://build.opensuse.org/request/show/1185310 Factory / texlive-specs-o
https://build.opensuse.org/request/show/1185311 Factory / texlive-specs-p
https://build.opensuse.org/request/show/1185312 Factory / texlive-specs-q
https://build.opensuse.org/request/show/1185313 Factory / texlive-specs-r
https://build.opensuse.org/request/show/1185314 Factory / texlive-specs-s
https://build.opensuse.org/request/show/1185315 Factory / texlive-specs-t
https://build.opensuse.org/request/show/1185316 Factory / texlive-specs-u
https://build.opensuse.org/request/show/1185317 Factory / texlive-specs-v
https://build.opensuse.org/request/show/1185318 Factory / texlive-specs-w
https://build.opensuse.org/request/show/1185319 Factory / texlive-specs-x
https://build.opensuse.org/request/show/1185320 Factory / texlive-specs-y
https://build.opensuse.org/request/show/1185321 Factory / texlive-specs-z