git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Carl Worth <cworth@cworth.org>
To: Andrew Vasquez <andrew.vasquez@qlogic.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Prevent git-upload-pack segfault if object cannot be found
Date: Wed, 22 Feb 2006 10:44:02 -0800	[thread overview]
Message-ID: <87bqwzs07h.wl%cworth@cworth.org> (raw)
In-Reply-To: <20060222181758.GH3355@andrew-vasquezs-powerbook-g4-15.local>

[-- Attachment #1: Type: text/plain, Size: 2024 bytes --]

On Wed, 22 Feb 2006 10:17:58 -0800, Andrew Vasquez wrote:
> Commit:
> 
> 	b5b16990f8b074bd0481ced047b8f8bf66eee6dc
> 	Prevent git-upload-pack segfault if object cannot be found
> 
> is causing some really annoying noise being sent to stderr on some of
> my older non-packed repositories:
> 
> 	$ git status
> 	# On branch refs/heads/b4
> 	unable to open object pack directory: .git/objects/pack: No such file or directory
> 	nothing to commit

Hmm... I can see that would be really annoying.

> > -	if (!dir)
> > +	if (!dir) {
> > +		fprintf(stderr, "unable to open object pack directory: %s: %s\n", path, strerror(errno));
> >  		return;
> > +	}
> 
> Could we drop this fprintf to stderr?

In the case in which I hit the original bug, this message is necessary
to provide information about where the actual problem is. Here is what
that scenario looks like with the message:

$ mkdir original;
$ (cd original; git-init-db; touch foo; git add foo; git commit -m "original")
defaulting to local storage area
Committing initial tree 4d5fcadc293a348e88f777dc0920f11e7d71441c
$ git clone -l -s original clone
$ mv original moved
$ git clone clone again
unable to open object pack directory: /tmp/original/.git/objects/pack: No such file or directory
fatal: git-upload-pack: cannot find object 0153d496df669cbe5cecb665dbe6f95b20461917:
fatal: unexpected EOF
clone-pack from '/tmp/clone/.git' failed.

Here the "cannot find object" message doesn't point to the core
problem, but the "unable to open object pack directory" does contain
the "/tmp/original" path of interest.

One could be a bit more careful about not complaining if <objdir>
actually does exist, even if <objdir>/pack does not.

Or a workaround would be to just run git-init-db in old repositories
to create the pack directory:

	$ rmdir .git/objects/pack/
	$ git status
	unable to open object pack directory: .git/objects/pack: No such file or directory
	nothing to commit
	$ git-init-db
	defaulting to local storage area
	$ git status
	nothing to commit

-Carl



[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

  parent reply	other threads:[~2006-02-22 18:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-22 18:17 [PATCH] Prevent git-upload-pack segfault if object cannot be found Andrew Vasquez
2006-02-22 18:26 ` Junio C Hamano
2006-02-22 18:44 ` Carl Worth [this message]
2006-02-22 18:50   ` Junio C Hamano
2006-02-22 19:11   ` Junio C Hamano
2006-02-22 19:16     ` Carl Worth
2006-02-23  0:34     ` Jonas Fonseca
2006-02-23  1:48       ` [PATCH] Give no terminating LF to error() function Junio C Hamano
  -- strict thread matches above, loose matches on Subject: below --
2006-02-18  0:14 [PATCH] Prevent git-upload-pack segfault if object cannot be found Carl Worth
2006-02-18  6:50 ` 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

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

  git send-email \
    --in-reply-to=87bqwzs07h.wl%cworth@cworth.org \
    --to=cworth@cworth.org \
    --cc=andrew.vasquez@qlogic.com \
    --cc=git@vger.kernel.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).