From: Carl Worth Subject: Re: [PATCH] Prevent git-upload-pack segfault if object cannot be found Date: Wed, 22 Feb 2006 10:44:02 -0800 Message-ID: <87bqwzs07h.wl%cworth@cworth.org> References: <20060222181758.GH3355@andrew-vasquezs-powerbook-g4-15.local> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: multipart/signed; boundary="pgp-sign-Multipart_Wed_Feb_22_10:43:56_2006-1"; micalg=pgp-sha1; protocol="application/pgp-signature" Content-Transfer-Encoding: 7bit Cc: git@vger.kernel.org X-From: git-owner@vger.kernel.org Wed Feb 22 19:46:09 2006 Return-path: Envelope-to: gcvg-git@gmane.org Received: from vger.kernel.org ([209.132.176.167]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FByzO-0006df-8e for gcvg-git@gmane.org; Wed, 22 Feb 2006 19:45:26 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751389AbWBVSpX (ORCPT ); Wed, 22 Feb 2006 13:45:23 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751390AbWBVSpX (ORCPT ); Wed, 22 Feb 2006 13:45:23 -0500 Received: from theworths.org ([217.160.253.102]:12723 "EHLO theworths.org") by vger.kernel.org with ESMTP id S1751389AbWBVSpX (ORCPT ); Wed, 22 Feb 2006 13:45:23 -0500 Received: (qmail 23800 invoked from network); 22 Feb 2006 13:45:21 -0500 Received: from localhost (HELO raht.cworth.org) (127.0.0.1) by localhost with SMTP; 22 Feb 2006 13:45:21 -0500 To: Andrew Vasquez In-Reply-To: <20060222181758.GH3355@andrew-vasquezs-powerbook-g4-15.local> User-Agent: Wanderlust/2.14.0 (Africa) Emacs/21.4 Mule/5.0 (SAKAKI) Sender: git-owner@vger.kernel.org Precedence: bulk X-Mailing-List: git@vger.kernel.org Archived-At: --pgp-sign-Multipart_Wed_Feb_22_10:43:56_2006-1 Content-Type: text/plain; charset=US-ASCII 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 actually does exist, even if /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 --pgp-sign-Multipart_Wed_Feb_22_10:43:56_2006-1 Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) iD8DBQBD/LDy6JDdNq8qSWgRAiEEAJ9AXek7kUFMFhm3ABJyYM+tJfI/AQCaAkeI qDNLHCjntDUQX6m8EpeHENs= =xUMG -----END PGP SIGNATURE----- --pgp-sign-Multipart_Wed_Feb_22_10:43:56_2006-1--