Re: [BUG] GIT_AUTHOR_NAME was checked before prepare_fallback got called (ps/stash-in-c)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 06, 2019 at 11:52:36AM -0800, Denton Liu wrote:

> Hello all,
> 
> I've been on "jch" for my daily use and I noticed today that git stash
> isn't working. I managed to debug it down to "ps/stash-in-c".
> 
> To reproduce on git.git, it's simply the following:
> 
> 	echo // >>dir.c
> 	git stash
> 
> This gives me the following error:
> 
> 	$ git stash
> 	BUG: ident.c:511: GIT_AUTHOR_NAME was checked before prepare_fallback got called
> 	Aborted (core dumped)
> 
> I haven't read through the branch's code so I'm not too familiar with
> the changes but please let me know if you need any other information or
> if there's anything I can help with.

Yeah, it seems like the code from fd5a58477c (ident: add the ability to
provide a "fallback identity", 2019-02-25) is over-eager:

  static void set_env_if(const char *key, const char *value, int *given, int bit)
  {
        if (*given & bit)
                BUG("%s was checked before prepare_fallback got called", key);
	...
  }

  void prepare_fallback_ident(const char *name, const char *email)
  {
        set_env_if("GIT_AUTHOR_NAME", name,
                   &author_ident_explicitly_given, IDENT_NAME_GIVEN);
	...
  }

If the ident comes from config, then those bits will be set already,
even if nobody ever looked at $GIT_AUTHOR_NAME. I think that BUG()
should actually just be a silent return.

-Peff



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux