git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Brandon Williams <bmwill@google.com>
Cc: "René Scharfe" <l.s.r@web.de>,
	"Johannes Schindelin" <johannes.schindelin@gmx.de>,
	git@vger.kernel.org, "Stefan Beller" <sbeller@google.com>,
	"Jeff King" <peff@peff.net>
Subject: Re: [PATCH 2/2] Fix callsites of real_pathdup() that wanted it to die on error
Date: Wed, 08 Mar 2017 13:16:20 -0800	[thread overview]
Message-ID: <xmqq4lz331wb.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20170308183840.GA130604@google.com> (Brandon Williams's message of "Wed, 8 Mar 2017 10:38:40 -0800")

Brandon Williams <bmwill@google.com> writes:

>> > diff --git a/abspath.c b/abspath.c
>> > index 2f0c26e0e2c..b02e068aa34 100644
>> > --- a/abspath.c
>> > +++ b/abspath.c
>> > @@ -214,12 +214,12 @@ const char *real_path_if_valid(const char *path)
>> >  	return strbuf_realpath(&realpath, path, 0);
>> >  }
>> >  
>> > -char *real_pathdup(const char *path)
>> > +char *real_pathdup(const char *path, int die_on_error)
>> 
>> Adding a gentle variant (with the current implementation) and making
>> real_pathdup() die on error would be nicer, as it doesn't require
>> callers to pass magic flag values.  Most cases use the dying variant,
>> so such a patch would have to touch less places:
>
> I agree with Junio and Rene that a gentle version would make the api
> slightly nicer (and more consistant with some of the other api's we have
> in git).
>
> This is exactly what I should have done back when I originally made the
> change.  Sorry for missing this!

While I agree that the shape of the code Rene gave us here is what
we would have liked to have in the original, it is a bit too late
for that.

As I already mentioned, as a regression fix patch, I find what Dscho
posted more sensible, because it makes it obvious that all existing
callsites were looked at while constructing the patch and more
importantly, it forces somebody to look at all the new callers of
the function that were added by the topics in flight, by changing
the func-signature and forcing compilation failure.

It may be somewhat unfortunate that that somebody needs to be me,
but that is what maintainers are for, so ... ;-)

Once the dust settles, let's do the clean-up along the lines of
Rene's patch.

Thanks.


  reply	other threads:[~2017-03-08 21:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-08 15:43 [PATCH 0/2] Fix crashes due to real_pathdup() potentially returning NULL Johannes Schindelin
2017-03-08 15:43 ` [PATCH 1/2] Demonstrate NULL pointer access with invalid GIT_WORK_TREE Johannes Schindelin
2017-03-08 15:43 ` [PATCH 2/2] Fix callsites of real_pathdup() that wanted it to die on error Johannes Schindelin
2017-03-08 18:12   ` René Scharfe
2017-03-08 18:38     ` Brandon Williams
2017-03-08 21:16       ` Junio C Hamano [this message]
2017-03-09 11:24         ` Johannes Schindelin
2017-03-09 16:33           ` René Scharfe
2017-03-08 16:17 ` [PATCH 0/2] Fix crashes due to real_pathdup() potentially returning NULL Jeff King
2017-03-09 11:26   ` Johannes Schindelin

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=xmqq4lz331wb.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=bmwill@google.com \
    --cc=git@vger.kernel.org \
    --cc=johannes.schindelin@gmx.de \
    --cc=l.s.r@web.de \
    --cc=peff@peff.net \
    --cc=sbeller@google.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).