Re: [bug] assertion in 2.8.4 triggering on old-ish worktree
- From
Chris Packham <judge.packham@gmail.com>
- Date
- Jun 17, 2016, 02:41 UTC
- Message-ID
- <CAFOYHZAnx-sg41OdFnbfgOkggfKCdAKXuMRXuKcbzaJibwR2Rw@mail.gmail.com>
- In-Reply-To
- <CAGZ79kZaZCwZ-cesB_voq0s0Qt+ipcgb6TkdzLE+EWSF_qRj7A@mail.gmail.com>
On Fri, Jun 17, 2016 at 7:48 AM, Stefan Beller <sbeller@google.com> wrote:
Show 20 quoted lines
> 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 .'
Show 12 quoted lines
>> >> >> 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>
Show 19 quoted lines
> 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; > }