git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tanay Abhra <tanayabh@gmail.com>
To: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
Cc: Junio C Hamano <gitster@pobox.com>,
	git@vger.kernel.org, Ramkumar Ramachandra <artagnon@gmail.com>
Subject: Re: [PATCH v9r2 1/2] add `config_set` API for caching config-like files
Date: Wed, 16 Jul 2014 22:14:27 +0530	[thread overview]
Message-ID: <53C6ABEB.3060205@gmail.com> (raw)
In-Reply-To: <vpqha2h9tjw.fsf@anie.imag.fr>



On 7/16/2014 9:36 PM, Matthieu Moy wrote:
> Tanay Abhra <tanayabh@gmail.com> writes:
> 
>> implemented as a thin wrapper around the `config_set` API.
>>
>> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
>> Signed-off-by: Tanay Abhra <tanayabh@gmail.com>
>>  Documentation/technical/api-config.txt | 137 +++++++++++++++++
>>  cache.h                                |  30 ++++
>>  config.c                               | 264 +++++++++++++++++++++++++++++++++
>>  3 files changed, 431 insertions(+)
> 
> (you broke the patch by removing the ---)
>

Yikes, sorry about that.

>> +static void git_config_check_init(void)
>> +{
>> +	if (the_config_set.hash_initialized)
>> +		return;
>> +	git_configset_init(&the_config_set);
>> +	git_config(config_set_callback, &the_config_set);
>> +}
> 
> So, you're now ignoring the return value of git_config. What is the
> rationale for this? In particular, why did you reject the "die"
> possibility (I understood that you were inclined to take this option, so
> I'm curious why you changed your mind).
>

The errors (non accessible, non existent files etc) were already being caught by
git_config_early(). Since git_config() only returns positive values except
the weird race case you mentioned, I thought the die confused the reader
of the patch more than it provided error checking. I also tried myself
simulating the race condition but failed. All the callers of git_config()
also ignore the return value, so I ended up ignoring the return value myself.

> OTOH, you're transmitting the return value without dying here:
> 
> +int git_configset_add_file(struct config_set *cs, const char *filename)
> +{
> +	return git_config_from_file(config_set_callback, filename, cs);
> +}
> 
> and I think this one is correct, as we cannot tell in advance how
> serious an error would be for any callers. And we do test this (I think
> we can improve a bit, I'll send a fixup patch).
>

After reading the commit log that you mentioned and some previous ones before
that I surmised that the official slant was to silently ignore nonexistent
files. Though an access_or_warn() check was placed on most of the files
like git attributes, since non accessible file errors may be a user configuration
error. So, I decided to ignore the return value.

But I do think that an access_or_warn() check should be put on git config --file
and git_configset_add_file since other parts of git follow it. What do
you think about it, still I will send followup patch correcting the git config
--file condition where it silently ignores the file access error and continues?

  parent reply	other threads:[~2014-07-16 16:44 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-15 14:29 [PATCH v9 0/3] git config cache & special querying api utilizing the cache Tanay Abhra
2014-07-15 14:29 ` [PATCH v9 1/2] add `config_set` API for caching config-like files Tanay Abhra
2014-07-15 15:46   ` Junio C Hamano
2014-07-15 16:22     ` Tanay Abhra
2014-07-16 11:41     ` [PATCH v9r1 " Tanay Abhra
2014-07-15 14:29 ` [PATCH v9 2/2] test-config: add tests for the config_set API Tanay Abhra
2014-07-15 15:57   ` Junio C Hamano
2014-07-15 17:07     ` Tanay Abhra
2014-07-15 18:26       ` Junio C Hamano
2014-07-16 11:44     ` [PATCH v9r1 " Tanay Abhra
2014-07-16 11:49       ` Matthieu Moy
2014-07-16 12:22         ` [PATCH v9r2 1/2] add `config_set` API for caching config-like files Tanay Abhra
2014-07-16 16:06           ` Matthieu Moy
2014-07-16 16:09             ` [PATCH 1/3] fixup for patch 2: minor style fix Matthieu Moy
2014-07-16 16:09               ` [PATCH 2/3] fixup for patch 2: actually check the return value Matthieu Moy
2014-07-16 16:55                 ` Tanay Abhra
2014-07-16 17:10                   ` Matthieu Moy
2014-07-16 16:09               ` [PATCH 3/3] fixup for patch 1: typo Matthieu Moy
2014-07-16 16:44             ` Tanay Abhra [this message]
2014-07-16 17:06               ` [PATCH v9r2 1/2] add `config_set` API for caching config-like files Matthieu Moy
     [not found]                 ` <53C6C2BD.3030703@gmail.com>
2014-07-17 10:01                   ` Matthieu Moy
2014-07-17 11:06                     ` Tanay Abhra
2014-07-17 11:34                       ` Matthieu Moy
2014-07-17 11:13                     ` Matthieu Moy
2014-07-17 17:12                       ` Junio C Hamano
2014-07-16 12:22         ` [PATCH v9r2 2/2] test-config: add tests for the config_set API Tanay Abhra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53C6ABEB.3060205@gmail.com \
    --to=tanayabh@gmail.com \
    --cc=Matthieu.Moy@grenoble-inp.fr \
    --cc=artagnon@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).