You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Lookup a non existent commit crashes the process. #353
I am doing some analysis of a codebase over time using nodegit, I am getting commits from an outside source that may no longer exist.
Doing Commit.lookup says it should be safe, but if I do a lookup with an invalid commit (but a full sha), I get the following error:
good repo
[Error: Object not found - failed to find pack entry (b5e13cc50f98d9a045bebadffacf396b9ee49ad5)]
node(16924,0x7fff73d77300) malloc: *** error for object 0x100d02be0: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Here is some example code that causes the failure:
varnodegit=require("nodegit")varRepo=nodegit.RepositoryvarCommit=nodegit.CommitRepo.open("/path/to/myrepo").then(function(repo){console.log("good repo")// missing, but valid full length, shareturnCommit.lookup(repo,"b5e13cc50f98d9a045bebadffacf396b9ee49ad5").then(function(commit){console.log(commit.message())},function(err){console.log(err);throwerr})},function(err){console.log(err);throwerr})
Using the example code that you provided I'm unable to get the malloc error. I do stil get the object not found error which is correct and to be expected.
Is there something I'm missing in your test case to get the malloc error?
If I use an invalid sha format (too short, etc) I get the error but no malloc error.
Here is a more precise example against the nodegit repo itself. I copied this code and dropped it into the root of nodegit on latest master. Still get the same error.
okay, first, thanks so much for being so responsive.
I didn't realize that you have a pre-built binary. It took me a bit to figure out how to rebuild. When I use the pre-built it fails, but when I build my own, from master or the branch in #354 they both work properly.
Not sure where it leaves this, but let me know if I can do anything further to help.
Oh ok. We must have fixed that in master then. I'll reject that PR and when we version bump you should be good. libgit2 released 0.21.4 so we should be version bumping here pretty soon.
Activity
johnhaley81 commentedon Jan 15, 2015
Using the example code that you provided I'm unable to get the malloc error. I do stil get the object not found error which is correct and to be expected.
Is there something I'm missing in your test case to get the malloc error?
addisonj commentedon Jan 15, 2015
hrm... odd.
If I use an invalid sha format (too short, etc) I get the error but no malloc error.
Here is a more precise example against the nodegit repo itself. I copied this code and dropped it into the root of nodegit on latest master. Still get the same error.
I wonder if it might be OS issue? I am running OSX Yosemite
johnhaley81 commentedon Jan 15, 2015
Running that code in the root of nodegit on the master branch I still can't get a malloc.
I'm on OSX Yosemite as well. What version of node are you running?
johnhaley81 commentedon Jan 15, 2015
Damn, unable to repo on either v0.10.33 or v0.11.14 of node.
addisonj commentedon Jan 15, 2015
v0.10.35johnhaley81 commentedon Jan 15, 2015
Updated to v0.10.35 and still no dice. I think I know the issue though. Can you checkout #354 and see if that fixes your problem?
addisonj commentedon Jan 15, 2015
okay, first, thanks so much for being so responsive.
I didn't realize that you have a pre-built binary. It took me a bit to figure out how to rebuild. When I use the pre-built it fails, but when I build my own, from
masteror the branch in #354 they both work properly.Not sure where it leaves this, but let me know if I can do anything further to help.
johnhaley81 commentedon Jan 15, 2015
Oh ok. We must have fixed that in master then. I'll reject that PR and when we version bump you should be good. libgit2 released 0.21.4 so we should be version bumping here pretty soon.
addisonj commentedon Jan 15, 2015
Sorry for the confusion. Once again, really appreciate the help!
On Thu Jan 15 2015 at 4:40:01 PM John Haley notifications@github.com
wrote:
johnhaley81 commentedon Jan 15, 2015
No worries! Always glad to help :)