Re: [PATCH v2 1/1] config: work around bug with includeif:onbranch and early config

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

 



On Wed, Jul 31, 2019 at 07:12:57PM -0400, Jeff King wrote:

> Hrm. But common-main calls initialize_the_repository(), which points it
> at &the_repo. And I can't find any other assignments. So how does it
> become NULL? And is every caller of have_git_dir() at risk of
> segfaulting?
> 
> Ah, I see. I think it is that trace2 reads the configuration very early.
> I think we ought to do this:
> 
> diff --git a/common-main.c b/common-main.c
> index 582a7b1886..89fd415e55 100644
> --- a/common-main.c
> +++ b/common-main.c
> @@ -39,14 +39,14 @@ int main(int argc, const char **argv)
>  
>  	git_resolve_executable_dir(argv[0]);
>  
> +	initialize_the_repository();
> +
>  	trace2_initialize();
>  	trace2_cmd_start(argv);
>  	trace2_collect_process_info(TRACE2_PROCESS_INFO_STARTUP);
>  
>  	git_setup_gettext();
>  
> -	initialize_the_repository();
> -
>  	attr_start();
>  
>  	result = cmd_main(argc, argv);

By the way, I wondered why trace2's existing config reading did not
cause us to segfault because of this. It is because it invented the
"very early config" function which always ignores some config sources
(working around this problem, but also making it weirdly unlike most
other config).

-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