Re: [PATCH] fix git-gui crash due to uninitialized variable
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jan 21, 2012, 22:13 UTC
- Message-ID
- <7v1uqsbt66.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <20120121175724.GA7319@ecki>
Clemens Buchacher <drizzd@aon.at> writes:
Show 6 quoted lines
> 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> > ---
Thanks, but Clemens, please don't Cc: me git-gui patches, which I won't take directly.
Pinging Pat.
Show 19 quoted lines
> 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}]