# Failure in t6021 on Red Hat Enterprise Linux 4

6 messages from 2005-12-07 to 2005-12-08. Participants: Mark Allen, Junio C Hamano.
Thread: https://gitlist.dev/t/2767

## Mark Allen, 2005-12-07 16:49

Subject: Failure in t6021 on Red Hat Enterprise Linux 4
Message-ID: <20051207164909.24221.qmail@web34304.mail.mud.yahoo.com>
URL: https://gitlist.dev/e/20051207164909.24221.qmail%40web34304.mail.mud.yahoo.com

```
Running t/t6021-crisscross-merge.sh -v -i on Red Hat Enterprise Linux 4 Workstation with
python 2.3.4 installed, I found a fatal error in the test.

Apparently, this release of python doesn't have the subprocess module installed. In what
package is that located? How can I fix this error?

Thanks!

--Mark

-- BEGIN --

[mallen@mrhat t]$ rpm -q python
python-2.3.4-14.1

...SNIP...

git commit -m D8 file
Committing initial tree ec103796f9a6ca8367bd90cd88edf39c5dd2ae26
Trying really trivial in-index merge...
fatal: Merge requires file-level merging
Nope.
Traceback (most recent call last):
  File "/home/mallen/git/git.git/t/../git-merge-recursive", line 13, in ?
    from gitMergeCommon import *
  File "/home/mallen/git/git.git/gitMergeCommon.py", line 18, in ?
    import subprocess
ImportError: No module named subprocess
Automatic merge failed/prevented; fix up by hand

...SNIP...

--- END ---

```

## Junio C Hamano, 2005-12-07 17:38

Subject: Re: Failure in t6021 on Red Hat Enterprise Linux 4
Message-ID: <7vfyp4u7rl.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vfyp4u7rl.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <20051207164909.24221.qmail@web34304.mail.mud.yahoo.com>

```
Mark Allen <mrallen1@yahoo.com> writes:

> Running t/t6021-crisscross-merge.sh -v -i on Red Hat Enterprise Linux 4 Workstation with
> python 2.3.4 installed, I found a fatal error in the test.

Are you using git RPM, or building by hand?

If the latter, "grep -A2 python INSTALL" may be helpful.

```

## Mark Allen, 2005-12-07 18:12

Subject: Re: Failure in t6021 on Red Hat Enterprise Linux 4
Message-ID: <20051207181225.67737.qmail@web34304.mail.mud.yahoo.com>
URL: https://gitlist.dev/e/20051207181225.67737.qmail%40web34304.mail.mud.yahoo.com
In-Reply-To: <7vfyp4u7rl.fsf@assigned-by-dhcp.cox.net>

```
--- Junio C Hamano <junkio@cox.net> wrote:
> Are you using git RPM, or building by hand?
> If the latter, "grep -A2 python INSTALL" may be helpful.

Definitely. Thanks for the pointer -- I rebuilt my git installation with the correct
flag, but there's a bootstrapping problem with the test -- and I'm not a good enough
python programmer to fix it very well.

So, basically the problem is that the subprocess.py module is in the compat directory,
and by default (I think) the git-merge-recursive being tested is only looking in
$HOME/git/git.git where it finds and loads gitMergeCommon.py, but gitMergeCommon.py is
not looking in $HOME/git/git.git/compat which is where subprocess.py lives.

So I hacked in to git-merge-recursive this line at the top of the file

sys.path.append('''/home/mallen/git/git.git/compat''')

at the very top and now the test passes.  

So maybe this points out a problem in the Makefile or in the substitution the Makefile is
using to put in @@GIT_PYTHON_PATH@@

I'm not sure I've clearly explained the issue, and like I said, I'm kind of a Python
baby, so I'm not sure what the best way to fix this problem might be.

Thanks,

--Mark

```

## Junio C Hamano, 2005-12-07 18:54

Subject: Re: Failure in t6021 on Red Hat Enterprise Linux 4
Message-ID: <7vslt4rb4v.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vslt4rb4v.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <20051207181225.67737.qmail@web34304.mail.mud.yahoo.com>

```

Mark Allen <mrallen1@yahoo.com> writes:

> So, basically the problem is that the subprocess.py module is
> in the compat directory, and by default (I think)..

Ah, you are right.

Just like we fix PATH and GIT_EXEC_PATH during the test
execution, we need to do something with PYTHONPATH environment
variable (this one is _without_ underscore), I think.

```

## Junio C Hamano, 2005-12-08 06:07

Subject: [PATCH] Make sure we use compat/subprocess.py with Python 2.3 while running tests.
Message-ID: <7vr78oktp0.fsf_-_@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vr78oktp0.fsf_-_%40assigned-by-dhcp.cox.net
In-Reply-To: <7vslt4rb4v.fsf@assigned-by-dhcp.cox.net>

```
Otherwise the test will not succeed without installing.

Signed-off-by: Junio C Hamano <junkio@cox.net>

---

  Junio C Hamano <junkio@cox.net> writes:

  > Mark Allen <mrallen1@yahoo.com> writes:
  >
  >> So, basically the problem is that the subprocess.py module is
  >> in the compat directory, and by default (I think)..
  >
  > Ah, you are right.
  >
  > Just like we fix PATH and GIT_EXEC_PATH during the test
  > execution, we need to do something with PYTHONPATH environment
  > variable (this one is _without_ underscore), I think.

  This seems to fix it for me.

 t/test-lib.sh |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

49ccb0877f64308662669a09db7b221419c13d0a
diff --git a/t/test-lib.sh b/t/test-lib.sh
index f2eccd7..0539dac 100755
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -172,7 +172,18 @@ test_done () {
 # t/ subdirectory and are run in trash subdirectory.
 PATH=$(pwd)/..:$PATH
 GIT_EXEC_PATH=$(pwd)/..
-export GIT_EXEC_PATH
+export PATH GIT_EXEC_PATH
+
+# Similarly use ../compat/subprocess.py if our python does not
+# have subprocess.py on its own.
+PYTHON=`sed -e '1{
+	s/^#!//
+	q
+}' ../git-merge-recursive` &&
+"$PYTHON" -c 'import subprocess' 2>/dev/null || {
+	PYTHONPATH=$(pwd)/../compat
+	export PYTHONPATH
+}
 
 # Test repository
 test=trash
-- 
0.99.9.GIT

```

## Mark Allen, 2005-12-08 17:04

Subject: Re: [PATCH] Make sure we use compat/subprocess.py with Python 2.3 while running tests.
Message-ID: <20051208170445.38067.qmail@web34302.mail.mud.yahoo.com>
URL: https://gitlist.dev/e/20051208170445.38067.qmail%40web34302.mail.mud.yahoo.com
In-Reply-To: <7vr78oktp0.fsf_-_@assigned-by-dhcp.cox.net>

```
--- Junio C Hamano <junkio@cox.net> wrote:
>   This seems to fix it for me.

Works on my build here. Thanks!

--Mark

```
