* `git p4` broken on machines which do not have python on path
@ 2025-02-06 1:27 Kapil Somani
2025-02-06 1:46 ` brian m. carlson
0 siblings, 1 reply; 5+ messages in thread
From: Kapil Somani @ 2025-02-06 1:27 UTC (permalink / raw)
To: git
Thank you for filling out a Git bug report!
Please answer the following questions to help us understand your issue.
What did you do before the bug happened? (Steps to reproduce your issue)
Run `git p4 clone //path/to/p4/depot --destination=/tmp/localcopy`
What did you expect to happen? (Expected behavior)
The command should have imported perforce depot to a git repository
What happened instead? (Actual behavior)
The command threw error
fatal: 'p4' appears to be a git command, but we were not
able to execute it. Maybe git-p4 is broken?
What's different between what you expected and what actually happened?
The command did not perform desired operation
Anything else you want to add:
The machine does not have python on path
I noticed `git-p4`'s shebang line points to python.
On my local git installation, i was able to update shebang line on
git-p4 to python3 and
the command worked as expected.
With python3 now being default should be update git-p4 to run using python3 ?
Please review the rest of the bug report below.
You can delete any lines you don't wish to share.
[System Info]
git version:
git version 2.30.2
cpu: x86_64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
uname: Linux 5.10.0-33-amd64 #1 SMP Debian 5.10.226-1 (2024-10-03) x86_64
compiler info: gnuc: 10.2
libc info: glibc: 2.31
$SHELL (typically, interactive shell): /bin/tcsh
[Enabled Hooks]
not run from a git repository - no hooks to show
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: `git p4` broken on machines which do not have python on path
2025-02-06 1:27 `git p4` broken on machines which do not have python on path Kapil Somani
@ 2025-02-06 1:46 ` brian m. carlson
2025-02-06 2:16 ` Illia Bobyr
[not found] ` <CANF_+=7hM7QqLNE3d4=UO-8erYoeQwYG5SrsDTXtgqZq3AKJwg@mail.gmail.com>
0 siblings, 2 replies; 5+ messages in thread
From: brian m. carlson @ 2025-02-06 1:46 UTC (permalink / raw)
To: Kapil Somani; +Cc: git
[-- Attachment #1: Type: text/plain, Size: 1959 bytes --]
On 2025-02-06 at 01:27:48, Kapil Somani wrote:
> Thank you for filling out a Git bug report!
> Please answer the following questions to help us understand your issue.
>
> What did you do before the bug happened? (Steps to reproduce your issue)
> Run `git p4 clone //path/to/p4/depot --destination=/tmp/localcopy`
>
>
> What did you expect to happen? (Expected behavior)
> The command should have imported perforce depot to a git repository
>
>
> What happened instead? (Actual behavior)
> The command threw error
> fatal: 'p4' appears to be a git command, but we were not
> able to execute it. Maybe git-p4 is broken?
Can you mention where you got your version of Git from? Is this a
Debian Git, one you compiled yourself, or another one entirely?
> What's different between what you expected and what actually happened?
> The command did not perform desired operation
>
>
> Anything else you want to add:
> The machine does not have python on path
> I noticed `git-p4`'s shebang line points to python.
> On my local git installation, i was able to update shebang line on
> git-p4 to python3 and
> the command worked as expected.
> With python3 now being default should be update git-p4 to run using python3 ?
I think if you compiled this yourself, you probably need to set
PYTHON_PATH to a suitable Python when running the Makefile, and that
will rewrite the shebang. If you got this from another source, then
they should have compiled the package with a suitable PYTHON_PATH and
depended on an appropriate version of Python.
I realize that Python 3 is now the default, but there were apparently
still some people who want to use Python 2.7 last time this came up, so
the default shebang hasn't changed. According to Python upstream,
`python` can be of any version, although for all distros I'm aware of,
`python` is always version 2.
--
brian m. carlson (they/them or he/him)
Toronto, Ontario, CA
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 263 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: `git p4` broken on machines which do not have python on path
2025-02-06 1:46 ` brian m. carlson
@ 2025-02-06 2:16 ` Illia Bobyr
[not found] ` <CANF_+=7hM7QqLNE3d4=UO-8erYoeQwYG5SrsDTXtgqZq3AKJwg@mail.gmail.com>
1 sibling, 0 replies; 5+ messages in thread
From: Illia Bobyr @ 2025-02-06 2:16 UTC (permalink / raw)
To: brian m. carlson, Kapil Somani, git
On 2/5/25 17:46, brian m. carlson wrote:
> I realize that Python 3 is now the default, but there were apparently
> still some people who want to use Python 2.7 last time this came up, so
> the default shebang hasn't changed. According to Python upstream,
> `python` can be of any version, although for all distros I'm aware of,
> `python` is always version 2.
I just checked my Ubuntu 24.10 and `python` is `python3`.
❯ python --version
Python 3.12.7
❯ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 24.10
Release: 24.10
Codename: oracular
❯ whereis python
python: /usr/bin/python
❯ dpkg -S /usr/bin/python
python-is-python3: /usr/bin/python
There are both `python-is-python2` and `python-is-python3` packages.
They just provide a symlink for convenience.
And one can use Python version managers to manage what `python` means,
of cause.
^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <CANF_+=7hM7QqLNE3d4=UO-8erYoeQwYG5SrsDTXtgqZq3AKJwg@mail.gmail.com>]
* Re: `git p4` broken on machines which do not have python on path
[not found] ` <CANF_+=7hM7QqLNE3d4=UO-8erYoeQwYG5SrsDTXtgqZq3AKJwg@mail.gmail.com>
@ 2025-02-06 22:18 ` brian m. carlson
2025-02-06 23:17 ` Junio C Hamano
0 siblings, 1 reply; 5+ messages in thread
From: brian m. carlson @ 2025-02-06 22:18 UTC (permalink / raw)
To: Kapil Somani; +Cc: git
[-- Attachment #1: Type: text/plain, Size: 858 bytes --]
On 2025-02-06 at 02:12:02, Kapil Somani wrote:
> Thanks for quick response Brian
>
> Yes, our team compiles git for use within our organization.
> I'll reach out to them and see if they can provide path during build.
>
> Meanwhile, I was able to update copy of the git (compiled by my team) to
> use python3 on shebang line.
> It appears that the git-p4 is compatible with Python3. Is git team planning
> to update it near future?
It's my understanding that it's designed to work with both Python 2 and
3. It's unlikely that the shebang will be updated until it's no longer
guaranteed to work with Python 2, since `python` is more generic than
`python3`. When that is, I don't know, since I don't use Perforce and
don't maintain git-p4, which has a separate maintainer.
--
brian m. carlson (they/them or he/him)
Toronto, Ontario, CA
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 263 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: `git p4` broken on machines which do not have python on path
2025-02-06 22:18 ` brian m. carlson
@ 2025-02-06 23:17 ` Junio C Hamano
0 siblings, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2025-02-06 23:17 UTC (permalink / raw)
To: brian m. carlson; +Cc: Kapil Somani, git
"brian m. carlson" <sandals@crustytoothpaste.net> writes:
> On 2025-02-06 at 02:12:02, Kapil Somani wrote:
>> Thanks for quick response Brian
>>
>> Yes, our team compiles git for use within our organization.
>> I'll reach out to them and see if they can provide path during build.
>>
>> Meanwhile, I was able to update copy of the git (compiled by my team) to
>> use python3 on shebang line.
>> It appears that the git-p4 is compatible with Python3. Is git team planning
>> to update it near future?
>
> It's my understanding that it's designed to work with both Python 2 and
> 3. It's unlikely that the shebang will be updated until it's no longer
Correct. The CI has jobs to try git-p4 with both python2 and python3
since Mar 2020.
> guaranteed to work with Python 2, since `python` is more generic than
> `python3`. When that is, I don't know, since I don't use Perforce and
> don't maintain git-p4, which has a separate maintainer.
I am not sure what story about shebang is discussed here.
If the complaint is "your script says '/usr/bin/env python', but my
users don't have 'python' on their $PATH", I think that is barking
up a wrong tree. As a general principle, we try not to rely on
"env".
Just like other scripts, we munge git-p4.py script to replace the
shebang line to use the path to the python binary specified by the
builder into resulting git-p4 "executable" file that is installed.
We do this (not specifically for git-p4 but as a general principle)
because we do not want to get affected by random customized versions
of stuff end-users install on their $PATH that overrides the ones
from the system that builders determined to be used by Git.
Is the complaint that "on my system there are /usr/bin/python2 and
/usr/bin/python3 but no vanilla /usr/bin/python installed"?
So it is your responsibility to tell the build procedure that you
want to use "/usr/bin/python3", as the build procedure defaults to
"/usr/bin/python" when you do not specify any.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-02-06 23:17 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-06 1:27 `git p4` broken on machines which do not have python on path Kapil Somani
2025-02-06 1:46 ` brian m. carlson
2025-02-06 2:16 ` Illia Bobyr
[not found] ` <CANF_+=7hM7QqLNE3d4=UO-8erYoeQwYG5SrsDTXtgqZq3AKJwg@mail.gmail.com>
2025-02-06 22:18 ` brian m. carlson
2025-02-06 23:17 ` Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).