Skip to content

Issue with pygit2's Conflict Iterator on SUSE SL-16.0 #1417

@thackara

Description

@thackara

hello, we have noticed a problem with pygit2's Conflict Iterator with SUSE SL-16.0 linux:
ref: https://build.opensuse.org/public/build/devel:languages:python/16.0/x86_64/python-pygit2/_log

The test_add_conflict test fails:

[ 24s] ______________________________ test_add_conflict _______________________________
[ 24s]

[ 24s] conflict_ancestor, conflict_ours, conflict_theirs = index.conflicts['conflict.txt']
[ 24s] > assert conflict_ancestor.id == ancestor_blob_id
[ 24s] E AttributeError: 'NoneType' object has no attribute 'id'
[ 24s]
[ 24s] test/test_index.py:335: AttributeError

# our comparion logs with libgit2(1.9.1) and pygit2(1.18.2)
#### on 16.0

# with libgit2: git_index_conflict_add(index, &ancestor_entry, &ours_entry, NULL) -> git_index_conflict_get -> git_index_conflict_next
# __getitem__ : git_index_conflict_get
# CI.__next__: Conflict Iterator


abuild@sodium:/tmp/testrepo.git> /tmp/test_libgit2_conflict
DBG1: __getitem__ raw pointers: ancestor=0x565538872c80 INFO: Ancestor entry found. OID: fe858dce6bd7636ebb180dfaab9a2e6414456f3a
DBG2: __getitem__ raw pointers: ours=0x565538872c10 INFO: Ours entry found. OID: 424860eef4edb9f5a2dacbbd6dc8c2d2e7645035
DBG3: conflict_iter=0x565538872fa0
DBG4: CI.__next__ raw pointers: ancestor=0x565538872c80 ours=0x565538872c10 theirs=(nil)
DBG5: CI.__next__ entry: Ancestor: path=conflict.txt, mode=33261
DBG6: CI.__next__ entry: Ours: path=conflict.txt, mode=33188
DBG7: CI.__next__ entry: Theirs: None
abuild@sodium:/tmp/testrepo.git>


# with pygit2: index.add_conflict(ancestor, ours, None) -> index.conflicts.get -> [iter]index.conflicts
# CC: Conflict Collector
# CI: Conflict Iterator

abuild@sodium:/tmp/testrepo.git> python3 /tmp/test_pygit2_conflict.py
DBG1: before: centry_ancestor=<cdata 'void *' NULL>, centry_ours=<cdata 'void *' NULL>, centry_theirs=<cdata 'void *' NULL>
DBG2: after_to_c: centry_ancestor=<cdata 'struct git_index_entry *' owning 72 bytes>, centry_ours=<cdata 'struct git_index_entry *' owning 72 bytes>, centry_theirs=<cdata 'void *' NULL>
DBG3: conflict_add_err=0
DBG4: CC.__getitem__ raw pointers: ancestor=<cdata 'struct git_index_entry *' NULL> ours=<cdata 'struct git_index_entry *' 0x559b17f8f130> theirs=<cdata 'struct git_index_entry *' NULL>
DBG5: CC.__getitem__ python objects: ancestor=None ours=<path=conflict.txt id=424860eef4edb9f5a2dacbbd6dc8c2d2e7645035 mode=33188> theirs=None
Ancestor entry NOT found.
Ours entry found. OID: 424860eef4edb9f5a2dacbbd6dc8c2d2e7645035
DBG6: CI.__next__ raw pointers: ancestor=<cdata 'struct git_index_entry *' 0x559b18204070> ours=<cdata 'struct git_index_entry *' NULL> theirs=<cdata 'struct git_index_entry *' NULL>
DBG7: CI.__next__ python objects: ancestor=<path=EEEEEEEEEEEEEEEE id=fe858dce6bd7636ebb180dfaab9a2e6414456f3a mode=33261> ours=None theirs=None
(<pygit2.index.IndexEntry path=EEEEEEEEEEEEEEEE id=fe858dce6bd7636ebb180dfaab9a2e6414456f3a mode=33261>, None, None)
DBG6: CI.__next__ raw pointers: ancestor=<cdata 'struct git_index_entry *' NULL> ours=<cdata 'struct git_index_entry *' 0x559b17f8f130> theirs=<cdata 'struct git_index_entry *' NULL>
DBG7: CI.__next__ python objects: ancestor=None ours=<path=conflict.txt id=424860eef4edb9f5a2dacbbd6dc8c2d2e7645035 mode=33188> theirs=None
(None, <pygit2.index.IndexEntry path=conflict.txt id=424860eef4edb9f5a2dacbbd6dc8c2d2e7645035 mode=33188>, None)
abuild@sodium:/tmp/testrepo.git>

-> the ConflictItertaor behaviour seems to be fine with openSUSE:Factory and openSUSE:Tumbleweed versions.

ancestor reference appears 'poisoned' (ancestor->path: EEEEEEEEEEEEEEEE)

it is possible the build enviornment enabled some memory sanitization, could you investigate this from the pygit2 aspect?

cc: @hramrach

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions