Re: [PATCH] trace2: teach Git to log environment variables

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

 



Josh Steadmon <steadmon@xxxxxxxxxx> writes:

> +trace2.envVars::
> +	A comma-separated list of "important" environment variables that should
> +	be recorded in the trace2 output.  For example,
> +	`GIT_HTTP_USER_AGENT,GIT_CONFIG` would cause the trace2 output to
> +	contain events listing the overrides for HTTP user agent and the
> +	location of the Git configuration file (assuming any are set).  May be
> +	overriden by the `GIT_TRACE2_ENV_VARS` environment variable.  Unset by
> +	default.

In other words, by default nothing is logged?

>  		trace2_cmd_alias(alias_command, new_argv);
>  		trace2_cmd_list_config();
> +		trace2_cmd_list_env_vars();

OK, so we treat the settings of configuration variables and
environment variables pretty much the same.  Both affect how git
behaves for the end-users, and even though they are physically
different mechanisms, philosophically the reason they are worth
logging are the same for these two categories.

> @@ -439,6 +441,7 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
>  	trace_argv_printf(argv, "trace: built-in: git");
>  	trace2_cmd_name(p->cmd);
>  	trace2_cmd_list_config();
> +	trace2_cmd_list_env_vars();

Likewise.  That is why these two appear together.

>  			trace2_cmd_name(cmds[i].name);
>  			trace2_cmd_list_config();
> +			trace2_cmd_list_env_vars();

And here.

> diff --git a/trace2/tr2_sysenv.c b/trace2/tr2_sysenv.c
> index 3c3792eca2..a380dcf910 100644
> --- a/trace2/tr2_sysenv.c
> +++ b/trace2/tr2_sysenv.c
> @@ -29,6 +29,8 @@ struct tr2_sysenv_entry {
>  static struct tr2_sysenv_entry tr2_sysenv_settings[] = {
>  	[TR2_SYSENV_CFG_PARAM]     = { "GIT_TRACE2_CONFIG_PARAMS",
>  				       "trace2.configparams" },
> +	[TR2_SYSENV_ENV_VARS]      = { "GIT_TRACE2_ENV_VARS",
> +				       "trace2.envvars" },
>  
>  	[TR2_SYSENV_DST_DEBUG]     = { "GIT_TRACE2_DST_DEBUG",
>  				       "trace2.destinationdebug" },

In this array, similar things are grouped together and groups are
separated by a blank line in between.  As the new ENV_VARS are
treated pretty much the same way as CFG_PARAM, it is thrown in the
same group, instead of becoming a group on its own.  Makes sense.


> diff --git a/trace2/tr2_sysenv.h b/trace2/tr2_sysenv.h
> index d4364a7b85..3292ee15bc 100644
> --- a/trace2/tr2_sysenv.h
> +++ b/trace2/tr2_sysenv.h
> @@ -11,6 +11,7 @@
>   */
>  enum tr2_sysenv_variable {
>  	TR2_SYSENV_CFG_PARAM = 0,
> +	TR2_SYSENV_ENV_VARS,
>  
>  	TR2_SYSENV_DST_DEBUG,

Likewise.

Thanks.



[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