threads / discuss / 2767

Failure in t6021 on Red Hat Enterprise Linux 4

Subject: Failure in t6021 on Red Hat Enterprise Linux 4

## tl;dr

6 messages between Dec 7, 2005 and Dec 8, 2005.

replies: 5people: 2as markdown or json

Mark Allen· Dec 7, 2005, 16:49 UTC · lore

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· Dec 7, 2005, 17:38 UTC · re: Mark Allen · lore

Re: Failure in t6021 on Red Hat Enterprise Linux 4

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· Dec 7, 2005, 18:12 UTC · re: Junio C Hamano · lore

Re: Failure in t6021 on Red Hat Enterprise Linux 4

--- 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· Dec 7, 2005, 18:54 UTC · re: Mark Allen · lore

Re: Failure in t6021 on Red Hat Enterprise Linux 4

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· Dec 8, 2005, 06:07 UTC · re: Junio C Hamano · lore

[PATCH] Make sure we use compat/subprocess.py with Python 2.3 while running tests.

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· Dec 8, 2005, 17:04 UTC · re: Junio C Hamano · lore

Re: [PATCH] Make sure we use compat/subprocess.py with Python 2.3 while running tests.

--- Junio C Hamano <junkio@cox.net> wrote:
>   This seems to fix it for me.
Works on my build here. Thanks!
--Mark

← back to recent threads