public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Pat Thoyts <patthoyts@users•sourceforge.net>
To: Clemens Buchacher <drizzd@aon•at>
Cc: git@vger•kernel.org, Junio C Hamano <gitster@pobox•com>
Subject: Re: [PATCH] fix git-gui crash due to uninitialized variable
Date: Sun, 22 Jan 2012 23:18:58 +0000	[thread overview]
Message-ID: <87bopvz5p9.fsf@fox.patthoyts.tk> (raw)
In-Reply-To: <20120121175724.GA7319@ecki> (Clemens Buchacher's message of "Sat, 21 Jan 2012 18:57:28 +0100")

Clemens Buchacher <drizzd@aon•at> writes:

>Recently, a clone initiated via git gui on Windows crashed on me due to
>an "unknown variable cdone". It turns out that there is a code path
>where this variable is used uninitialized.
>
>Signed-off-by: Clemens Buchacher <drizzd@aon•at>
>---
>
>Looking at the output of display(), it's not clear to me now the
>function below could ever be called with total=0. But I can't delve into
>it more deeply right now, and this seems like an obvious fix.
>
> git-gui/lib/status_bar.tcl |    1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
>diff --git a/git-gui/lib/status_bar.tcl b/git-gui/lib/status_bar.tcl
>index 95cb449..02111a1 100644
>--- a/git-gui/lib/status_bar.tcl
>+++ b/git-gui/lib/status_bar.tcl
>@@ -77,6 +77,7 @@ method start {msg uds} {
> 
> method update {have total} {
> 	set pdone 0
>+	set cdone 0
> 	if {$total > 0} {
> 		set pdone [expr {100 * $have / $total}]
> 		set cdone [expr {[winfo width $w_c] * $have / $total}]

It might be nice to know what kind of conditions triggered this for you,
but the patch is fine. Thanks, applied.

-- 
Pat Thoyts                            http://www.patthoyts.tk/
PGP fingerprint 2C 6E 98 07 2C 59 C8 97  10 CE 11 E6 04 E0 B9 DD

      parent reply	other threads:[~2012-01-22 23:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-21 17:57 [PATCH] fix git-gui crash due to uninitialized variable Clemens Buchacher
2012-01-21 22:13 ` Junio C Hamano
2012-01-22 23:18 ` Pat Thoyts [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=87bopvz5p9.fsf@fox.patthoyts.tk \
    --to=patthoyts@users$(echo .)sourceforge.net \
    --cc=drizzd@aon$(echo .)at \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitster@pobox$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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