Bug 1004918

Summary: git.Repo(os.getcwd()).repo.head.commit doesn't work at i686
Product: [Fedora] Fedora Reporter: Igor Gnatenko <ignatenko>
Component: pythonAssignee: Bohuslav "Slavek" Kabrda <bkabrda>
Status: CLOSED CANTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 19CC: alex.mail.1534, besser82, bkabrda, dennis, dmalcolm, gwync, ignatenko, ivazqueznet, jonathansteffan, mstuchli, tomspur, trevor
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-09-16 12:02:58 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:
Attachments:
Description Flags
test.py none

Description Igor Gnatenko 2013-09-05 18:08:02 UTC
Created attachment 794428 [details]
test.py

Description of problem:
git.Repo(os.getcwd()).repo.head.commit doesn't work at i686

Version-Release number of selected component (if applicable):
git-1.8.3.1-1.fc19.i686
GitPython-0.3.2-0.4.RC1.fc19.noarch
python-2.7.5-4.fc19.i686

How reproducible:
always

Steps to Reproduce:
1. clone any git repo (e.g. Linus kernel tree)
2. cd to clonned repo
3. run test script

Actual results:
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Traceback (most recent call last):
  File "../../bar.py", line 9, in <module>
    headcommit = head.commit
  File "/usr/lib/python2.7/site-packages/git/refs/symbolic.py", line 168, in
_get_commit
    obj = self._get_object()
  File "/usr/lib/python2.7/site-packages/git/refs/symbolic.py", line 161, in
_get_object
    return Object.new_from_sha(self.repo,
hex_to_bin(self.dereference_recursive(self.repo, self.path)))
  File "/usr/lib/python2.7/site-packages/git/objects/base.py", line 64, in
new_from_sha
    oinfo = repo.odb.info(sha1)
  File "/usr/lib/python2.7/site-packages/gitdb/db/base.py", line 256, in
info
    return self._db_query(sha).info(sha)
  File "/usr/lib/python2.7/site-packages/gitdb/db/base.py", line 239, in
_db_query
    if db.has_object(sha):
  File "/usr/lib/python2.7/site-packages/gitdb/db/pack.py", line 88, in
has_object
    self._pack_info(sha)
  File "/usr/lib/python2.7/site-packages/gitdb/db/pack.py", line 71, in
_pack_info
    index = item[2](sha)
  File "/usr/lib/python2.7/site-packages/gitdb/pack.py", line 492, in
sha_to_index
    return PackIndexFile_sha_to_index(self, sha)
ValueError: Couldn't obtain fanout table

Expected results:
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
ae7a835cc546fc67df90edaaa0c48ae2b22a29fe

Additional info:
This arch-specify problem. At x86_64 isn't present.

Comment 1 Fl@sh 2013-09-06 16:32:19 UTC
 I'm sorry to interrupt, but:
PackIndexFile_sha_to_index imported from _perf :

/usr/lib/python2.7/site-packages/gitdb/pack.py", line 34:

from _perf import PackIndexFile_sha_to_index

It is the /usr/lib64/python2.7/site-packages/gitdb/_perf.so

# yum provides */_perf.so  --disablerepo=*debug*
.... 
python-gitdb-0.5.4-5.fc19.x86_64 : A pure-Python git object database
Repo        : fedora
Matched from:
Filename    : /usr/lib64/python2.7/site-packages/gitdb/_perf.so

python-gitdb-0.5.4-5.fc19.x86_64 : A pure-Python git object database
Repo        : @fedora
Matched from:
Filename    : /usr/lib64/python2.7/site-packages/gitdb/_perf.so

Therefore this bug should be redirected to python-gitdb package.

Comment 2 Gwyn Ciesla 2013-09-06 17:26:41 UTC
python-gitdb-0.5.4-4.fc18.armv6hl
GitPython-0.3.2-0.3.RC1.fc18.noarch
python-2.7.3-13.fc18.1302271210kf.armv6hl
git-1.8.0.1-1.fc18.armv6hl

Seems to work.

Comment 3 Fl@sh 2013-09-06 17:58:57 UTC
maybe I'm wrong, but it's just such an Exception:
/home/Flash/gitdb-0.5.4/gitdb/_fun.c , line 27-32 :

// read lo and hi bounds
	PyObject* fanout_table = PyObject_GetAttrString(inst, "_fanout_table");
	if (!fanout_table){
		PyErr_SetString(PyExc_ValueError, "Couldn't obtain fanout table");
		return NULL;
	}

=> that is, it is not the fault of _perf.so
 ;)

Comment 4 Fl@sh 2013-09-06 19:57:33 UTC
it seems this is the last redirected ( LOL ) :

if bug exist, then it is here :

http://docs.python.org/2/c-api/object.html
    PyObject* PyObject_GetAttrString(PyObject *o, const char *attr_name)

or variable inst really do not have that option :D

Comment 5 Igor Gnatenko 2013-09-06 20:00:53 UTC
Tested on bubuntu i686. Bug isn't present.
git (1.8.3.2-1)
python-gitdb (0.5.4-1)
python-git (0.3.2~RC1-2)
python (2.7.5-4)

Comment 6 Fl@sh 2013-09-06 20:08:11 UTC
(In reply to Igor Gnatenko from comment #5)
> Tested on bubuntu i686. Bug isn't present.
> git (1.8.3.2-1)
> python-gitdb (0.5.4-1)
> python-git (0.3.2~RC1-2)
> python (2.7.5-4)

To be sure it would be good to compare the code in gitdb-0.5.4/gitdb/_fun.c, line 27-32. If the code is identical, then just need to redirect to python package.

Comment 7 Igor Gnatenko 2013-09-06 20:20:20 UTC
(In reply to Fl@sh from comment #6)
> (In reply to Igor Gnatenko from comment #5)
> > Tested on bubuntu i686. Bug isn't present.
> > git (1.8.3.2-1)
> > python-gitdb (0.5.4-1)
> > python-git (0.3.2~RC1-2)
> > python (2.7.5-4)
> 
> To be sure it would be good to compare the code in gitdb-0.5.4/gitdb/_fun.c,
> line 27-32. If the code is identical, then just need to redirect to python
> package.
identical. ok. re-assign.

Comment 8 Fl@sh 2013-09-06 20:27:50 UTC
however, the error may be to initialize the variable inst here :
/home/Flash/gitdb-0.5.4/gitdb/_fun.c , line 12-15 :

// get instance and sha
	PyObject* inst = 0;
	if (!PyArg_ParseTuple(args, "Os#", &inst, &sha, &sha_len))
		return NULL;

but it does not change anything. It's all the same python.

Comment 9 Bohuslav "Slavek" Kabrda 2013-09-16 12:02:58 UTC
Definitely not a Python issue. Running under python-debug, I get:

git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Traceback (most recent call last):
  File "a.py", line 9, in <module>
    headcommit = head.commit
  File "/usr/lib/python2.7/site-packages/git/refs/symbolic.py", line 168, in _get_commit
    obj = self._get_object()
  File "/usr/lib/python2.7/site-packages/git/refs/symbolic.py", line 161, in _get_object
    return Object.new_from_sha(self.repo, hex_to_bin(self.dereference_recursive(self.repo, self.path)))
  File "/usr/lib/python2.7/site-packages/git/objects/base.py", line 64, in new_from_sha
    oinfo = repo.odb.info(sha1)
  File "/usr/lib/python2.7/site-packages/gitdb/db/base.py", line 256, in info
    return self._db_query(sha).info(sha)
  File "/usr/lib/python2.7/site-packages/gitdb/db/base.py", line 239, in _db_query
    if db.has_object(sha):
  File "/usr/lib/python2.7/site-packages/gitdb/db/pack.py", line 88, in has_object
    self._pack_info(sha)
  File "/usr/lib/python2.7/site-packages/gitdb/db/pack.py", line 71, in _pack_info
    index = item[2](sha)
  File "/usr/lib/python2.7/site-packages/gitdb/pack.py", line 419, in sha_to_index
    get_sha = self.sha
  File "/usr/lib/python2.7/site-packages/gitdb/util.py", line 238, in __getattr__
    self._set_cache_(attr)
  File "/usr/lib/python2.7/site-packages/gitdb/pack.py", line 281, in _set_cache_
    mmap = self._cursor.map()
  File "/usr/lib/python2.7/site-packages/gitdb/util.py", line 238, in __getattr__
    self._set_cache_(attr)
  File "/usr/lib/python2.7/site-packages/gitdb/pack.py", line 274, in _set_cache_
    raise AssertionError("The index file at %s is too large to fit into a mapped window (%i > %i). This is a limitation of the implementation" % (self._indexpath, self._cursor.file_size(), mman.window_size()))
AssertionError: The index file at /root/linux/.git/objects/pack/pack-9e6f8c55dcde2d199604b5efe6db04bb5269e364.idx is too large to fit into a mapped window (90411812 > 33554432). This is a limitation of the implementation


So I'm closing this as cantfix, sorry. If you really need to use this on big indexes (like linux kernel), try using 64bit machine (on small indexes, it works like a charm).

Comment 10 Igor Gnatenko 2013-09-16 12:08:21 UTC
But why on ububuntu all works fine on i686?

Comment 11 Bohuslav "Slavek" Kabrda 2013-09-16 12:18:44 UTC
(In reply to Igor Gnatenko from comment #10)
> But why on ububuntu all works fine on i686?

Did you test it on sufficiently large repository, e.g. linux kernel? It works ok on small repositories on i686.

Comment 12 Igor Gnatenko 2013-09-16 12:23:44 UTC
(In reply to Bohuslav "Slavek" Kabrda from comment #11)
> (In reply to Igor Gnatenko from comment #10)
> > But why on ububuntu all works fine on i686?
> 
> Did you test it on sufficiently large repository, e.g. linux kernel? It
> works ok on small repositories on i686.
yeah. I will re-test on bubuntu i686 w/ Linus git tree and if that works will re-open this bug..