* [bug] assertion in 2.8.4 triggering on old-ish worktree @ 2016-06-16 4:59 Chris Packham 2016-06-16 5:02 ` Chris Packham 0 siblings, 1 reply; 8+ messages in thread From: Chris Packham @ 2016-06-16 4:59 UTC (permalink / raw) To: GIT Hi All, I have the git-sh-prompt configured in my .bashrc today I visited an old worktree that I haven't really touched in a few years (sorry can't remember the git version I was using back then). I received the following output when changing to the directory git: pathspec.c:317: prefix_pathspec: Assertion `item->nowildcard_len <= item->len && item->prefix <= item->len' failed. I assume it's one of the git invocations in git-sh-prompt that's hitting the assertion. Any thoughts on what might be triggering it? Any debug I can gather? ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [bug] assertion in 2.8.4 triggering on old-ish worktree 2016-06-16 4:59 [bug] assertion in 2.8.4 triggering on old-ish worktree Chris Packham @ 2016-06-16 5:02 ` Chris Packham 2016-06-16 16:31 ` Stefan Beller ` (2 more replies) 0 siblings, 3 replies; 8+ messages in thread From: Chris Packham @ 2016-06-16 5:02 UTC (permalink / raw) To: GIT On Thu, Jun 16, 2016 at 4:59 PM, Chris Packham <judge.packham@gmail.com> wrote: > Hi All, > > I have the git-sh-prompt configured in my .bashrc today I visited an > old worktree that I haven't really touched in a few years (sorry can't > remember the git version I was using back then). I received the > following output when changing to the directory > > git: pathspec.c:317: prefix_pathspec: Assertion `item->nowildcard_len > <= item->len && item->prefix <= item->len' failed. > > I assume it's one of the git invocations in git-sh-prompt that's > hitting the assertion. Any thoughts on what might be triggering it? > Any debug I can gather? A bit more info. The directory in question is a uninitialised submodule. It doesn't trigger in the root of the parent project. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [bug] assertion in 2.8.4 triggering on old-ish worktree 2016-06-16 5:02 ` Chris Packham @ 2016-06-16 16:31 ` Stefan Beller 2016-06-16 16:55 ` Dennis Kaarsemaker 2016-06-16 17:59 ` Junio C Hamano 2 siblings, 0 replies; 8+ messages in thread From: Stefan Beller @ 2016-06-16 16:31 UTC (permalink / raw) To: Chris Packham; +Cc: GIT On Wed, Jun 15, 2016 at 10:02 PM, Chris Packham <judge.packham@gmail.com> wrote: > On Thu, Jun 16, 2016 at 4:59 PM, Chris Packham <judge.packham@gmail.com> wrote: >> Hi All, >> >> I have the git-sh-prompt configured in my .bashrc today I visited an >> old worktree that I haven't really touched in a few years (sorry can't >> remember the git version I was using back then). I received the >> following output when changing to the directory >> >> git: pathspec.c:317: prefix_pathspec: Assertion `item->nowildcard_len >> <= item->len && item->prefix <= item->len' failed. >> >> I assume it's one of the git invocations in git-sh-prompt that's >> hitting the assertion. Any thoughts on what might be triggering it? >> Any debug I can gather? The first step would be to identify which git command is actually causing it. Can you take your git-sh-prompt and run it step by step to figure out what command is failing? The next step after that would be to see if we can reproduce it in a reduced test case (with no real data) so we can add a regression test and a fix for it. > > A bit more info. The directory in question is a uninitialised > submodule. It doesn't trigger in the root of the parent project. so it's a cd submodule git <command> that is failing? Thanks, Stefan > -- > To unsubscribe from this list: send the line "unsubscribe git" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [bug] assertion in 2.8.4 triggering on old-ish worktree 2016-06-16 5:02 ` Chris Packham 2016-06-16 16:31 ` Stefan Beller @ 2016-06-16 16:55 ` Dennis Kaarsemaker 2016-06-16 16:59 ` Stefan Beller 2016-06-16 17:59 ` Junio C Hamano 2 siblings, 1 reply; 8+ messages in thread From: Dennis Kaarsemaker @ 2016-06-16 16:55 UTC (permalink / raw) To: Chris Packham, GIT On do, 2016-06-16 at 17:02 +1200, Chris Packham wrote: > On Thu, Jun 16, 2016 at 4:59 PM, Chris Packham <judge.packham@gmail.c > om> wrote: > > > > Hi All, > > > > I have the git-sh-prompt configured in my .bashrc today I visited > > an > > old worktree that I haven't really touched in a few years (sorry > > can't > > remember the git version I was using back then). I received the > > following output when changing to the directory > > > > git: pathspec.c:317: prefix_pathspec: Assertion `item- > > >nowildcard_len > > <= item->len && item->prefix <= item->len' failed. > > > > I assume it's one of the git invocations in git-sh-prompt that's > > hitting the assertion. Any thoughts on what might be triggering it? > > Any debug I can gather? > A bit more info. The directory in question is a uninitialised > submodule. It doesn't trigger in the root of the parent project. That very much smells like a class of bugs we've seen before, with git getting confused around submodules. See also for example https://www.mail-archive.com/git@vger.kernel.org/msg68447.html I don't think an accepted fix exists yet. D. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [bug] assertion in 2.8.4 triggering on old-ish worktree 2016-06-16 16:55 ` Dennis Kaarsemaker @ 2016-06-16 16:59 ` Stefan Beller 0 siblings, 0 replies; 8+ messages in thread From: Stefan Beller @ 2016-06-16 16:59 UTC (permalink / raw) To: Dennis Kaarsemaker; +Cc: Chris Packham, GIT On Thu, Jun 16, 2016 at 9:55 AM, Dennis Kaarsemaker <dennis@kaarsemaker.net> wrote: > On do, 2016-06-16 at 17:02 +1200, Chris Packham wrote: >> On Thu, Jun 16, 2016 at 4:59 PM, Chris Packham <judge.packham@gmail.c >> om> wrote: >> > >> > Hi All, >> > >> > I have the git-sh-prompt configured in my .bashrc today I visited >> > an >> > old worktree that I haven't really touched in a few years (sorry >> > can't >> > remember the git version I was using back then). I received the >> > following output when changing to the directory >> > >> > git: pathspec.c:317: prefix_pathspec: Assertion `item- >> > >nowildcard_len >> > <= item->len && item->prefix <= item->len' failed. >> > >> > I assume it's one of the git invocations in git-sh-prompt that's >> > hitting the assertion. Any thoughts on what might be triggering it? >> > Any debug I can gather? >> A bit more info. The directory in question is a uninitialised >> submodule. It doesn't trigger in the root of the parent project. > > That very much smells like a class of bugs we've seen before, with git > getting confused around submodules. See also for example > > https://www.mail-archive.com/git@vger.kernel.org/msg68447.html > > I don't think an accepted fix exists yet. Thanks for pointing me at that report. I was not aware of this "class of bugs", I'll see if I can fix it. Thanks, Stefan > > D. > -- > To unsubscribe from this list: send the line "unsubscribe git" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [bug] assertion in 2.8.4 triggering on old-ish worktree 2016-06-16 5:02 ` Chris Packham 2016-06-16 16:31 ` Stefan Beller 2016-06-16 16:55 ` Dennis Kaarsemaker @ 2016-06-16 17:59 ` Junio C Hamano 2016-06-16 19:48 ` Stefan Beller 2 siblings, 1 reply; 8+ messages in thread From: Junio C Hamano @ 2016-06-16 17:59 UTC (permalink / raw) To: Chris Packham; +Cc: GIT Chris Packham <judge.packham@gmail.com> writes: > On Thu, Jun 16, 2016 at 4:59 PM, Chris Packham <judge.packham@gmail.com> wrote: >> Hi All, >> >> I have the git-sh-prompt configured in my .bashrc today I visited an >> old worktree that I haven't really touched in a few years (sorry can't >> remember the git version I was using back then). I received the >> following output when changing to the directory >> >> git: pathspec.c:317: prefix_pathspec: Assertion `item->nowildcard_len >> <= item->len && item->prefix <= item->len' failed. >> >> I assume it's one of the git invocations in git-sh-prompt that's >> hitting the assertion. Any thoughts on what might be triggering it? >> Any debug I can gather? > > A bit more info. The directory in question is a uninitialised > submodule. It doesn't trigger in the root of the parent project. Sounds like http://article.gmane.org/gmane.comp.version-control.git/283549 ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [bug] assertion in 2.8.4 triggering on old-ish worktree 2016-06-16 17:59 ` Junio C Hamano @ 2016-06-16 19:48 ` Stefan Beller 2016-06-17 2:41 ` Chris Packham 0 siblings, 1 reply; 8+ messages in thread From: Stefan Beller @ 2016-06-16 19:48 UTC (permalink / raw) To: Junio C Hamano; +Cc: Chris Packham, GIT On Thu, Jun 16, 2016 at 10:59 AM, Junio C Hamano <gitster@pobox.com> wrote: > Chris Packham <judge.packham@gmail.com> writes: > >> On Thu, Jun 16, 2016 at 4:59 PM, Chris Packham <judge.packham@gmail.com> wrote: >>> Hi All, >>> >>> I have the git-sh-prompt configured in my .bashrc today I visited an >>> old worktree that I haven't really touched in a few years (sorry can't >>> remember the git version I was using back then). I received the >>> following output when changing to the directory >>> >>> git: pathspec.c:317: prefix_pathspec: Assertion `item->nowildcard_len >>> <= item->len && item->prefix <= item->len' failed. >>> >>> I assume it's one of the git invocations in git-sh-prompt that's >>> hitting the assertion. Any thoughts on what might be triggering it? >>> Any debug I can gather? >> >> A bit more info. The directory in question is a uninitialised >> submodule. It doesn't trigger in the root of the parent project. > > > Sounds like > http://article.gmane.org/gmane.comp.version-control.git/283549 > I looked into this. In pathspec.c#prefix_pathspec (the function that has this assertion at the end), the assertion can only trigger if PATHSPEC_STRIP_SUBMODULE_SLASH_EXPENSIVE or PATHSPEC_STRIP_SUBMODULE_SLASH_CHEAP was given as these are the only places that reduce item->len. I converted the example test case to follow our test syntax (module tab/whitespace issues): test_expect_success 'remove submodule and add its files' ' mkdir test && ( cd test && git init sub && ( cd sub && touch foo && git add foo && git commit -m "foo" ) && git init && git add sub && rm -rf sub/.git && ( cd sub && git add . ) ) ' And the issue here is that the submodule $GIT_DIR was removed, so that the "git add ." was called with the parents $GIT_DIR, and a prefix of sub/ (the slash will be removed in PATHSPEC_STRIP_SUBMODULE_SLASH...) such that the length will be 3 ("sub") and the other (prefix, nowildcard_len) are still 4. One fix would be to adjust prefix and nowildcard_len as well (in case they were as long as len, and now are overlength, if they were shorter, no need to cut off one) However I think that is missleading. So let's step back a bit and think about what should happen in the test case above. I think the users intent may be "remove the submodule and add the files directly to the regular tree". However this would not happen in case we do the quickfix of cutting one off prefix and nowildcard_len, because we have similar thing as a D/F (directory/file) conflict, just that it is a TREE/SUBMODULE conflict. In the parent project there is still a submodule recorded for sub/ but the user wants it to be a tree, so we would have to rewrite that. Using "rm -rf sub/.git" is a bad UI for saying " I want this to be a native tree/blobs instead of a submodule", so I would expect that we need to have another command there eventually (git submodule convert-to-subtree ?) Regarding the assert: We are sure it's a submodule related thing, so we can have a quite narrow warning there, roughly: diff --git a/pathspec.c b/pathspec.c index c9e9b6c..d0ea87a 100644 --- a/pathspec.c +++ b/pathspec.c @@ -313,8 +313,11 @@ static unsigned prefix_pathspec(struct pathspec_item *item, } /* sanity checks, pathspec matchers assume these are sane */ - assert(item->nowildcard_len <= item->len && - item->prefix <= item->len); + if (item->nowildcard_len <= item->len && + item->prefix <= item->len) + die (_("Path leads inside submodule '%s', but the submodule " + "was not recognized, i.e. not initialized or deleted"), + ce->name); return magic; } ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [bug] assertion in 2.8.4 triggering on old-ish worktree 2016-06-16 19:48 ` Stefan Beller @ 2016-06-17 2:41 ` Chris Packham 0 siblings, 0 replies; 8+ messages in thread From: Chris Packham @ 2016-06-17 2:41 UTC (permalink / raw) To: Stefan Beller; +Cc: Junio C Hamano, GIT On Fri, Jun 17, 2016 at 7:48 AM, Stefan Beller <sbeller@google.com> wrote: > On Thu, Jun 16, 2016 at 10:59 AM, Junio C Hamano <gitster@pobox.com> wrote: >> Chris Packham <judge.packham@gmail.com> writes: >> >>> On Thu, Jun 16, 2016 at 4:59 PM, Chris Packham <judge.packham@gmail.com> wrote: >>>> Hi All, >>>> >>>> I have the git-sh-prompt configured in my .bashrc today I visited an >>>> old worktree that I haven't really touched in a few years (sorry can't >>>> remember the git version I was using back then). I received the >>>> following output when changing to the directory >>>> >>>> git: pathspec.c:317: prefix_pathspec: Assertion `item->nowildcard_len >>>> <= item->len && item->prefix <= item->len' failed. >>>> >>>> I assume it's one of the git invocations in git-sh-prompt that's >>>> hitting the assertion. Any thoughts on what might be triggering it? >>>> Any debug I can gather? >>> >>> A bit more info. The directory in question is a uninitialised >>> submodule. It doesn't trigger in the root of the parent project. The command that fails appears to be 'git check-ignore -q .' >> >> >> Sounds like >> http://article.gmane.org/gmane.comp.version-control.git/283549 >> > > I looked into this. In pathspec.c#prefix_pathspec (the function > that has this assertion at the end), the assertion can only > trigger if PATHSPEC_STRIP_SUBMODULE_SLASH_EXPENSIVE > or PATHSPEC_STRIP_SUBMODULE_SLASH_CHEAP was given > as these are the only places that reduce item->len. > <snip> > Regarding the assert: > We are sure it's a submodule related thing, so we can > have a quite narrow warning there, roughly: > > diff --git a/pathspec.c b/pathspec.c > index c9e9b6c..d0ea87a 100644 > --- a/pathspec.c > +++ b/pathspec.c > @@ -313,8 +313,11 @@ static unsigned prefix_pathspec(struct pathspec_item *item, > } > > /* sanity checks, pathspec matchers assume these are sane */ > - assert(item->nowildcard_len <= item->len && > - item->prefix <= item->len); > + if (item->nowildcard_len <= item->len && > + item->prefix <= item->len) > + die (_("Path leads inside submodule '%s', but the submodule " > + "was not recognized, i.e. not initialized or deleted"), > + ce->name); This certainly would have pointed out the uninitialised state of my setup in this case. > return magic; > } ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2016-06-17 2:41 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-06-16 4:59 [bug] assertion in 2.8.4 triggering on old-ish worktree Chris Packham 2016-06-16 5:02 ` Chris Packham 2016-06-16 16:31 ` Stefan Beller 2016-06-16 16:55 ` Dennis Kaarsemaker 2016-06-16 16:59 ` Stefan Beller 2016-06-16 17:59 ` Junio C Hamano 2016-06-16 19:48 ` Stefan Beller 2016-06-17 2:41 ` Chris Packham
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).