From: Nicolas Pitre <nico@fluxnic.net>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org, git-dev@github.com,
"Shawn O. Pearce" <spearce@spearce.org>
Subject: Re: [PATCH] pack-objects: protect against disappearing packs
Date: Thu, 13 Oct 2011 22:43:54 -0400 (EDT) [thread overview]
Message-ID: <alpine.LFD.2.02.1110132242540.17040@xanadu.home> (raw)
In-Reply-To: <20111014013130.GA7163@sigill.intra.peff.net>
On Thu, 13 Oct 2011, Jeff King wrote:
> On Thu, Oct 13, 2011 at 09:23:20PM -0400, Jeff King wrote:
>
> > diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
> > index 2b18de5..8681ccd 100644
> > --- a/builtin/pack-objects.c
> > +++ b/builtin/pack-objects.c
> > @@ -804,6 +804,10 @@ static int add_object_entry(const unsigned char *sha1, enum object_type type,
> > off_t offset = find_pack_entry_one(sha1, p);
> > if (offset) {
> > if (!found_pack) {
> > + if (!is_pack_valid(p)) {
> > + error("packfile %s cannot be accessed", p->pack_name);
> > + continue;
> > + }
>
> This message is modeled after the one in find_pack_entry. However,
> they're not really errors, since we will try to find the object
> elsewhere (and generally succeed). So the messages could just go away.
> Though they can also alert you to something fishy going on (like a
> packfile with bad permissions). But perhaps we should downgrade them
> like this:
>
> -- >8 --
> Subject: [PATCH] downgrade "packfile cannot be accessed" errors to warnings
>
> These can happen if another process simultaneously prunes a
> pack. But that is not usually an error condition, because a
> properly-running prune should have repacked the object into
> a new pack. So we will notice that the pack has disappeared
> unexpectedly, print a message, try other packs (possibly
> after re-scanning the list of packs), and find it in the new
> pack.
>
> Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Nicolas Pitre <nico@fluxnic.net>
> ---
> builtin/pack-objects.c | 2 +-
> sha1_file.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
> index 8681ccd..ba3705d 100644
> --- a/builtin/pack-objects.c
> +++ b/builtin/pack-objects.c
> @@ -805,7 +805,7 @@ static int add_object_entry(const unsigned char *sha1, enum object_type type,
> if (offset) {
> if (!found_pack) {
> if (!is_pack_valid(p)) {
> - error("packfile %s cannot be accessed", p->pack_name);
> + warning("packfile %s cannot be accessed", p->pack_name);
> continue;
> }
> found_offset = offset;
> diff --git a/sha1_file.c b/sha1_file.c
> index a22c5b4..27f3b9b 100644
> --- a/sha1_file.c
> +++ b/sha1_file.c
> @@ -2038,7 +2038,7 @@ static int find_pack_entry(const unsigned char *sha1, struct pack_entry *e)
> * was loaded!
> */
> if (!is_pack_valid(p)) {
> - error("packfile %s cannot be accessed", p->pack_name);
> + warning("packfile %s cannot be accessed", p->pack_name);
> goto next;
> }
> e->offset = offset;
> --
> 1.7.6.4.37.g43b58b
>
next prev parent reply other threads:[~2011-10-14 2:44 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-14 1:23 [PATCH] pack-objects: protect against disappearing packs Jeff King
2011-10-14 1:31 ` Jeff King
2011-10-14 2:43 ` Nicolas Pitre [this message]
2011-10-14 2:42 ` Nicolas Pitre
2011-10-14 13:02 ` Jeff King
2011-10-14 7:06 ` Johannes Sixt
2011-10-14 13:07 ` Jeff King
2011-10-14 14:35 ` Johannes Sixt
2011-10-14 18:03 ` [PATCH 1/2] " Jeff King
2011-10-14 18:04 ` [PATCH 2/2] downgrade "packfile cannot be accessed" errors to warnings Jeff King
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=alpine.LFD.2.02.1110132242540.17040@xanadu.home \
--to=nico@fluxnic.net \
--cc=git-dev@github.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
--cc=spearce@spearce.org \
/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).