git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH 5/5] dir.c: stop ignoring opendir() error in open_cached_dir()
Date: Fri, 02 Feb 2018 00:00:15 +0100	[thread overview]
Message-ID: <87d11omi2o.fsf@evledraar.gmail.com> (raw)
In-Reply-To: <20180124093023.9071-6-pclouds@gmail.com>


On Wed, Jan 24 2018, Nguyễn Thái Ngọc Duy jotted:

> A follow-up to the recently fixed bugs in the untracked
> invalidation. If opendir() fails it should show a warning, perhaps
> this should die, but if this ever happens the error is probably
> recoverable for the user, and dying would just make things worse.
>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
> ---
>  dir.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/dir.c b/dir.c
> index 44b4dd2ec8..55736d3e2a 100644
> --- a/dir.c
> +++ b/dir.c
> @@ -1787,11 +1787,16 @@ static int open_cached_dir(struct cached_dir *cdir,
>  			   struct strbuf *path,
>  			   int check_only)
>  {
> +	const char *c_path;
> +
>  	memset(cdir, 0, sizeof(*cdir));
>  	cdir->untracked = untracked;
>  	if (valid_cached_dir(dir, untracked, istate, path, check_only))
>  		return 0;
> -	cdir->fdir = opendir(path->len ? path->buf : ".");
> +	c_path = path->len ? path->buf : ".";
> +	cdir->fdir = opendir(c_path);
> +	if (!cdir->fdir)
> +		warning_errno(_("could not open directory '%s'"), c_path);
>  	if (dir->untracked) {
>  		invalidate_directory(dir->untracked, untracked);
>  		dir->untracked->dir_opened++;

I haven't found the root cause yet, but we should not release a 2.17
with this patch.

I tried deploying a 2.16.1 + various patches (including this) internally
today, and on a test set of 236 machines with existing checkouts
(already using untracked cache) 79 would spew "warning: could not open
directory" warnings, warning about a lot of directories that did not
exist at the currently checked-out commit.

The warnings go away on a one-off:

    git -c core.untrackedCache=false status

So there's some issue where an existing index with stale UC will be used
by a newer version of git, and will start very verbosely warning about
every directory referenced that can't be found anymore.

  reply	other threads:[~2018-02-01 23:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-18  9:50 [PATCH] dir.c: print correct errno when opendir() fails Nguyễn Thái Ngọc Duy
2018-01-19 21:09 ` Junio C Hamano
2018-01-21 11:52   ` Duy Nguyen
2018-01-24  9:30 ` [PATCH 0/5] nd/fix-untracked-cache-invalidation updates Nguyễn Thái Ngọc Duy
2018-01-24  9:30   ` [PATCH 1/5] status: add a failing test showing a core.untrackedCache bug Nguyễn Thái Ngọc Duy
2018-01-24  9:30   ` [PATCH 2/5] dir.c: avoid stat() in valid_cached_dir() Nguyễn Thái Ngọc Duy
2018-01-24  9:30   ` [PATCH 3/5] dir.c: fix missing dir invalidation in untracked code Nguyễn Thái Ngọc Duy
2018-01-24  9:30   ` [PATCH 4/5] update-index doc: note a fixed bug in the untracked cache Nguyễn Thái Ngọc Duy
2018-01-24  9:30   ` [PATCH 5/5] dir.c: stop ignoring opendir() error in open_cached_dir() Nguyễn Thái Ngọc Duy
2018-02-01 23:00     ` Ævar Arnfjörð Bjarmason [this message]
2018-01-24 11:47   ` [PATCH 0/5] nd/fix-untracked-cache-invalidation updates Ævar Arnfjörð Bjarmason
2018-01-24 20:41     ` Junio C Hamano

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=87d11omi2o.fsf@evledraar.gmail.com \
    --to=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=pclouds@gmail.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).