All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: Edmundo Carmona Antoranz <eantoranz@gmail.com>,
	whydoubt@gmail.com, git@vger.kernel.org
Subject: Re: [PATCH] blame: report correct number of lines in progress when using ranges
Date: Mon, 04 Apr 2022 09:34:21 -0700	[thread overview]
Message-ID: <xmqq5ynost82.fsf@gitster.g> (raw)
In-Reply-To: <220404.8635itl6h0.gmgdl@evledraar.gmail.com> ("Ævar Arnfjörð Bjarmason"'s message of "Mon, 04 Apr 2022 08:12:06 +0200")

Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:

>> diff --git a/builtin/blame.c b/builtin/blame.c
>> index 8d15b68afc..e33372c56b 100644
>> --- a/builtin/blame.c
>> +++ b/builtin/blame.c
>> @@ -898,6 +898,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
>>  	unsigned int range_i;
>>  	long anchor;
>>  	const int hexsz = the_hash_algo->hexsz;
>> +	long num_lines = 0;
>
> Here ranges's nr is unsigned int, and the "num_lines" is an int, and the
> argument to start_delayed_progress() is uint64_t, but both of "start"
> and "end" are "long".

I see num_lines is a long, which I am guessing was made to match
what start and end are, which in turn is to use parse_range_arg().

> But we appand multiple differences to num_lines, are we sure we won't
> overflow here?

Looking at members of blame_entry and blame_scoreboard structures, I
think we make liberal use of "int" in the blame codepath without
worrying about those with 16-bit int, or those with files longer
than 2G lines, and progress meter showing incorrect values to them
is probably the least of our worries ;-)


      reply	other threads:[~2022-04-04 21:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-03 16:50 [PATCH] blame: report correct number of lines in progress when using ranges Edmundo Carmona Antoranz
2022-04-03 22:42 ` Junio C Hamano
2022-04-04  5:27   ` Edmundo Carmona Antoranz
2022-04-04  6:15     ` Ævar Arnfjörð Bjarmason
2022-04-04  6:12 ` Ævar Arnfjörð Bjarmason
2022-04-04 16:34   ` Junio C Hamano [this message]

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=xmqq5ynost82.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=avarab@gmail.com \
    --cc=eantoranz@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=whydoubt@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.