git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Sebastian Schuberth <sschuberth@gmail.com>,
	Patrick Steinhardt <ps@pks.im>,
	Lukas Fleischer <lfleischer@lfos.de>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH 0/2] fix clone guess_dir_name regression in v2.4.8
Date: Wed, 5 Aug 2015 17:04:54 -0400	[thread overview]
Message-ID: <20150805210454.GA21134@sigill.intra.peff.net> (raw)
In-Reply-To: <xmqq8u9p4pqb.fsf@gitster.dls.corp.google.com>

On Wed, Aug 05, 2015 at 10:19:56AM -0700, Junio C Hamano wrote:

> >> I think this regression is in v2.4.8, as well. We should be able to use
> >> a running "len" instead of the "end" pointer in the earlier part, and
> >> then use strip_suffix_mem later (to strip from our already-reduced
> >> length, rather than the full NUL-terminated string). Like this:
> >
> > Looks like "git clone --bare host:foo/.git" is broken, too. I've added
> > some tests to cover the recently broken cases, as well as some obvious
> > normal cases (which the patch I sent earlier break!). And as a bonus, we
> > can easily cover Patrick's root-repo problems (so people will actually
> > run the tests, unlike the stuff in t1509. :) ).
> 
> Sorry, my fault; I should have been much less trusting while queuing
> a patch like that offending one that was meant to be a no-op.

I reviewed it, too. :-/

I actually did give some thought to that while working on the fix. Why
did we miss what in retrospect was a pretty obvious bug? I saw two
interesting bits:

  1. From the diff context, it looked like a perfectly reasonable
     change; the shrinking of the "end" pointer happened further up
     in the function.

     So I guess the lesson is not to trust reading just the diff, and
     to really read the whole of the modified function. But that's easy
     to say in retrospect; most of the time the bits outside the context
     aren't interesting, and we can't afford to read the whole code
     base for each patch. It's a judgement call where to stop looking at
     the surrounding context of a given change (e.g., the function, the
     callers, their callers, etc).

  2. We didn't have any test coverage in this area; when I wrote even
     basic tests, it caught the problem.

     I hate to set a rule like "if you are cleaning something up, make
     sure there is decent test coverage". Lots of trivial-looking
     patches really are trivial, and it doesn't make sense to insist the
     submitter add a new battery of tests.

So I dunno. This was definitely preventable, but that is all in
retrospect. Bugs will happen, and we usually catch them while cooking.
The biggest pain is that this slipped through to a release, and that may
just be a measure of how few people were impacted (the cases it affected
were relatively obscure).

-Peff

  reply	other threads:[~2015-08-05 21:05 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-09 15:33 [PATCH] clone: Make use of the strip_suffix() helper method Sebastian Schuberth
2015-07-09 17:00 ` Jeff King
2015-07-09 17:16   ` Sebastian Schuberth
2015-07-09 17:23     ` [PATCH v2] clone: Simplify string handling in guess_dir_name() Sebastian Schuberth
2015-07-09 18:05       ` Junio C Hamano
2015-07-09 18:16         ` Sebastian Schuberth
2015-07-09 18:20           ` [PATCH v3] " Sebastian Schuberth
2015-07-09 18:24           ` [PATCH v4] clone: simplify " Sebastian Schuberth
2015-07-09 21:21             ` Junio C Hamano
2015-07-09 21:23               ` Sebastian Schuberth
2015-08-04  4:34             ` Lukas Fleischer
2015-08-04  7:31               ` Sebastian Schuberth
2015-08-04 22:42                 ` Jeff King
2015-08-05  6:08                   ` Patrick Steinhardt
2015-08-05  8:41                     ` Jeff King
2015-08-05  9:06                       ` Patrick Steinhardt
2015-08-05  9:09                         ` Jeff King
2015-08-05  8:35                   ` [PATCH 0/2] fix clone guess_dir_name regression in v2.4.8 Jeff King
2015-08-05  8:36                     ` [PATCH 1/2] clone: add tests for output directory Jeff King
2015-08-05  8:39                     ` [PATCH 2/2] clone: use computed length in guess_dir_name Jeff King
2015-08-05  8:49                       ` Sebastian Schuberth
2015-08-05 17:19                     ` [PATCH 0/2] fix clone guess_dir_name regression in v2.4.8 Junio C Hamano
2015-08-05 21:04                       ` Jeff King [this message]
2015-07-09 18:40           ` [PATCH v2] clone: Simplify string handling in guess_dir_name() 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=20150805210454.GA21134@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=lfleischer@lfos.de \
    --cc=ps@pks.im \
    --cc=sschuberth@gmail.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.
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).