Bug 2043652
| Summary: | /usr/bin/thg should not have -s "don't add user site directory to sys.path" in Python shebang | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Simon Sapin <simon-bugzila-redhat> |
| Component: | tortoisehg | Assignee: | Mads Kiilerich <mads> |
| Status: | CLOSED ERRATA | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 35 | CC: | mads, ndbecker2 |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | tortoisehg-6.0-3.fc36 tortoisehg-5.9.3-3.fc35 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2022-01-26 15:33:28 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
Note to self: This is caused by the %build section using %py3_build which expands to: /usr/bin/python3 setup.py build '--executable=/usr/bin/python3 -s' using %py3_shebang_flags . setup.py uses distutils, and in /usr/lib64/python3.10/distutils/command/build_scripts.py it uses this specified "executable" to adjust the #! line when copying the source 'thg' to 'build/scripts-3.10/thg'. In %install, %py3_install will install that into $RPM_BUILD_ROOT/usr/bin/thg . -s is really a good thing for system installed python programs so user's can't break it, and sad that the Mercurial extension system is incompatible. I will disable py3_shebang_flags. (It also has the minor eye-hurting side effect that the #! line ends with a space ;-) ) FEDORA-2022-0d11fa0da8 has been submitted as an update to Fedora 36. https://bodhi.fedoraproject.org/updates/FEDORA-2022-0d11fa0da8 FEDORA-2022-0d11fa0da8 has been pushed to the Fedora 36 stable repository. If problem still persists, please make note of it in this bug report. FEDORA-2022-ccab8e7817 has been submitted as an update to Fedora 35. https://bodhi.fedoraproject.org/updates/FEDORA-2022-ccab8e7817 Thanks for finding this! I've been wondering why I had trouble with thg finding my locally installed extensions. FEDORA-2022-ccab8e7817 has been pushed to the Fedora 35 testing repository. Soon you'll be able to install the update with the following command: `sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2022-ccab8e7817` You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-ccab8e7817 See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates. FEDORA-2022-ccab8e7817 has been pushed to the Fedora 35 stable repository. If problem still persists, please make note of it in this bug report. |
Description of problem: The shebang is `#!/usr/bin/python3 -s`, which breaks user-installed Mercurial extensions Version-Release number of selected component (if applicable): 5.9.3-2.fc35 How reproducible: Always Steps to Reproduce: 1. Install Mercurial and TortoiseHg from Fedora packages 2. The "evolve" Mercurial extension is not available as a Fedora package, so install it as a user: `pip install --user hg-evolve` 3. Enable it in ~/.hgrc: [extensions] topic = evolve = 4. Check installation: `hg help evolve` 5. Run `thg` for GUI visualization Actual results: On stderr: *** failed to import extension topic: No module named 'topic' *** failed to import extension evolve: No module named 'evolve' In GUI: TortoiseHg starts but shows an incomplete (arguably incorrect) graph. Expected results: TortoiseHg can load user-install Mercurial extensions just like CLI `hg` can. Additional info: Running `python3 /usr/bin/thg` works as expected. The culprit is the `-s` flag that is part of the shebang line of /usr/bin/thg. This flag is not present upstream: https://foss.heptapod.net/mercurial/tortoisehg/thg/-/blob/branch/stable/thg so it is presumably added by Fedora packaging. Per https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_shebangs "undefining the `%{py3_shebang_flags}` macro" would be appropriate here, though I don’t know how that can be done.