Re: [PATCH v3 3/3] config: allow overriding of global and system configuration
From: Junio C Hamano <hidden>
Date: 2021-04-12 17:04:56
Patrick Steinhardt [off-list ref] writes:
char *git_system_config(void)
{
+ char *system_config = xstrdup_or_null(getenv("GIT_CONFIG_SYSTEM"));
+ if (system_config) {
+ if (!strcmp(system_config, "/dev/null"))
+ FREE_AND_NULL(system_config);
+ return system_config;
+ }
I am not sure if returning NULL from this function will always be
the same as returning /dev/null on a system with functioning
/dev/null. For example, when use_system_config is enabled,
builtin/config.c::cmd_config() assigns the NULL returned by this
function to given_config_source.file and then calls
config.c::config_with_options(), which notices that none of
use_stdin, file, or blob member of the config_source exists and
falls back to the config_sequence().
So, for the purpose of special casing "/dev/null" textually, the
above is not sufficient, I am afraid.
Let's rescind the "/dev/null gets turned into NULL" in the above
change for now. If we truly want to cater to an installation where
open("/dev/null") fails and emulate, that needs to be done at a much
lower layer, but we do not have to go there for the purpose of this
series.
Thanks.