All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Sunshine <sunshine@sunshineco.com>
To: Pranit Bauva <pranit.bauva@gmail.com>
Cc: Git List <git@vger.kernel.org>,
	Christian Couder <christian.couder@gmail.com>,
	Christian Couder <chriscool@tuxfamily.org>,
	Lars Schneider <larsxschneider@gmail.com>
Subject: Re: [PATCH 1/2] bisect--helper: `is_expected_rev` shell function in C
Date: Thu, 9 Jun 2016 17:39:15 -0400	[thread overview]
Message-ID: <CAPig+cTAQAnTwQ7=Akw7N6FJS6jKc7hmZFVW=03b9NVD9+22ew@mail.gmail.com> (raw)
In-Reply-To: <CAPig+cRC_y9MBSsrLEs0OxL4=FMfU-=ACwhESUiECrWrDNvaCw@mail.gmail.com>

On Thu, Jun 9, 2016 at 5:33 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:
> On Wed, Jun 8, 2016 at 11:24 AM, Pranit Bauva <pranit.bauva@gmail.com> wrote:
>> +       strbuf_trim(&actual_hex);
>> +       return !strcmp(actual_hex.buf, expected_hex);
>
> Thus, it only ever gets to this point if the file exists but is empty,
> which is very unlikely to match 'expected_hex'. I could understand it
> if you checked the result of strbuf_read_file() with <0 or even <=0,
> but the current code doesn't make sense to me.

By the way, this is also leaking strbuf 'actual_hex'.

  reply	other threads:[~2016-06-09 21:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-08 15:24 [PATCH 1/2] bisect--helper: `is_expected_rev` shell function in C Pranit Bauva
2016-06-08 15:24 ` [PATCH 2/2] bisect--helper: `check_expected_revs` " Pranit Bauva
2016-06-09 21:54   ` Eric Sunshine
2016-06-10  7:52     ` Pranit Bauva
2016-06-09 21:33 ` [PATCH 1/2] bisect--helper: `is_expected_rev` " Eric Sunshine
2016-06-09 21:39   ` Eric Sunshine [this message]
2016-06-10 13:39   ` Pranit Bauva
2016-06-10 19:14     ` Eric Sunshine
2016-06-11 12:18       ` Pranit Bauva

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='CAPig+cTAQAnTwQ7=Akw7N6FJS6jKc7hmZFVW=03b9NVD9+22ew@mail.gmail.com' \
    --to=sunshine@sunshineco.com \
    --cc=chriscool@tuxfamily.org \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=larsxschneider@gmail.com \
    --cc=pranit.bauva@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.