From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-1.6 required=3.0 tests=AWL,BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_HI,RCVD_IN_SORBS_WEB,T_RP_MATCHES_RCVD shortcircuit=no autolearn=no autolearn_force=no version=3.4.0 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id 6ABC81F8CF for ; Thu, 8 Jun 2017 10:01:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751252AbdFHKBU (ORCPT ); Thu, 8 Jun 2017 06:01:20 -0400 Received: from mout.gmx.net ([212.227.15.15]:62214 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751587AbdFHKBT (ORCPT ); Thu, 8 Jun 2017 06:01:19 -0400 Received: from virtualbox ([37.201.192.198]) by mail.gmx.com (mrgmx003 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MhRUQ-1dWk8J0VFq-00MZKo; Thu, 08 Jun 2017 12:00:57 +0200 Date: Thu, 8 Jun 2017 12:00:56 +0200 (CEST) From: Johannes Schindelin X-X-Sender: virtualbox@virtualbox To: Brandon Williams cc: git@vger.kernel.org, Junio C Hamano Subject: Re: [PATCH 1/9] discover_git_directory(): avoid setting invalid git_dir In-Reply-To: <20170607174529.GB110638@google.com> Message-ID: References: <300d32d72b67f8c12b6cc91c36a5735a77f5ed89.1496851544.git.johannes.schindelin@gmx.de> <20170607174529.GB110638@google.com> User-Agent: Alpine 2.21.1 (DEB 209 2017-03-23) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Provags-ID: V03:K0:M0K3XVNOEKx+kvt67n5O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-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Hi Brandon, On Wed, 7 Jun 2017, Brandon Williams wrote: > On 06/07, Johannes Schindelin wrote: > > > diff --git a/setup.c b/setup.c > > index e3f7699a902..2435186e448 100644 > > --- a/setup.c > > +++ b/setup.c > > @@ -982,6 +982,7 @@ const char *discover_git_directory(struct strbuf *gitdir) > > warning("ignoring git dir '%s': %s", > > gitdir->buf + gitdir_offset, err.buf); > > strbuf_release(&err); > > + strbuf_setlen(gitdir, gitdir_offset); > > return NULL; > > There is another part of this function that returns NULL (which isn't > shown by this diff) after performing 'setup_git_dir_gently_1', do we > need to worry about anything that 'setup_git_dir_gently_1' has > potentially appended to 'gitdir' upon 'setup_git_dir_gently_1' failing? The setup_git_dir_gently_1() function used to set the git_dir variable directly in case of success, and leave it unchanged in case of error. My work to allow an early config did not change that, with the exception that it is the gitdir parameter that is changed instead of git_dir. In other words: that `return NULL` is safe, as it returns due to an error reported by the setup_git_directory_gently_1() function (meaning that the gitdir strbuf has not been touched). I amended the commit message accordingly, and force-pushed the result. Meaning: v2 will have that change. Ciao, Dscho