All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix git-gui crash due to uninitialized variable
@ 2012-01-21 17:57 Clemens Buchacher
  2012-01-21 22:13 ` Junio C Hamano
  2012-01-22 23:18 ` Pat Thoyts
  0 siblings, 2 replies; 3+ messages in thread
From: Clemens Buchacher @ 2012-01-21 17:57 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

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}]
-- 
1.7.8

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] fix git-gui crash due to uninitialized variable
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2012-01-21 22:13 UTC (permalink / raw)
  To: Clemens Buchacher, Pat Thoyts; +Cc: git

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>
> ---

Thanks, but Clemens, please don't Cc: me git-gui patches, which I won't
take directly.

Pinging Pat.

> 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}]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] fix git-gui crash due to uninitialized variable
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Pat Thoyts @ 2012-01-22 23:18 UTC (permalink / raw)
  To: Clemens Buchacher; +Cc: git, Junio C Hamano

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-01-22 23:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 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.