Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame^] | 1 | From 78f482b91d94b44a02e02c4580166757119061ea Mon Sep 17 00:00:00 2001 |
Andrew Geissler | 615f2f1 | 2022-07-15 14:00:58 -0500 | [diff] [blame] | 2 | From: Paulo Neves <ptsneves@gmail.com> |
| 3 | Date: Tue, 7 Jun 2022 16:16:41 +0200 |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame^] | 4 | Subject: [PATCH] Avoid shebang overflow on python-config.py |
Andrew Geissler | 615f2f1 | 2022-07-15 14:00:58 -0500 | [diff] [blame] | 5 | |
| 6 | The whole native path may be too big, leading to shebang |
| 7 | overflow. Let's just use the env shebang. |
| 8 | |
| 9 | Denial reason: [1] |
| 10 | |
| 11 | Upstream-Status: Denied [distribution] |
| 12 | |
| 13 | [1] https://github.com/python/cpython/pull/93760#pullrequestreview-1005365737 |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame^] | 14 | |
Andrew Geissler | 615f2f1 | 2022-07-15 14:00:58 -0500 | [diff] [blame] | 15 | --- |
| 16 | Makefile.pre.in | 2 ++ |
| 17 | 1 file changed, 2 insertions(+) |
| 18 | |
| 19 | diff --git a/Makefile.pre.in b/Makefile.pre.in |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame^] | 20 | index 55c7c46..1f6500a 100644 |
Andrew Geissler | 615f2f1 | 2022-07-15 14:00:58 -0500 | [diff] [blame] | 21 | --- a/Makefile.pre.in |
| 22 | +++ b/Makefile.pre.in |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame^] | 23 | @@ -2115,6 +2115,8 @@ python-config: $(srcdir)/Misc/python-config.in Misc/python-config.sh |
Andrew Geissler | 615f2f1 | 2022-07-15 14:00:58 -0500 | [diff] [blame] | 24 | @ # Substitution happens here, as the completely-expanded BINDIR |
| 25 | @ # is not available in configure |
| 26 | sed -e "s,@EXENAME@,$(BINDIR)/python$(LDVERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config.py |
| 27 | + @ # Otherwise we might get huge shebangs with native paths |
| 28 | + sed -i -e '1s|^#!.*|#!/usr/bin/env python3|' python-config.py |
| 29 | @ # Replace makefile compat. variable references with shell script compat. ones; $(VAR) -> ${VAR} |
| 30 | LC_ALL=C sed -e 's,\$$(\([A-Za-z0-9_]*\)),\$$\{\1\},g' < Misc/python-config.sh >python-config |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame^] | 31 | @ # On Darwin, always use the python version of the script, the shell |