From 0b883ab30c869c4f22a19e49aedc1604d335cd91 Mon Sep 17 00:00:00 2001 From: Gerrit Pape Date: Fri, 7 Sep 2007 17:16:59 +0000 Subject: git-gui: lib/index.tcl: handle files with % in the filename properly Steps to reproduce the bug: $ mkdir repo && cd repo && git init Initialized empty Git repository in .git/ $ touch 'foo%3Fsuite' $ git-gui Then click on the 'foo%3Fsuite' icon to include it in a changeset, a popup comes with: 'Error: bad field specifier "F"' Vincent Danjean noticed the problem and also suggested the fix, reported through http://bugs.debian.org/441167 Signed-off-by: Gerrit Pape Signed-off-by: Shawn O. Pearce diff --git a/lib/index.tcl b/lib/index.tcl index f47f929..cbbce13 100644 --- a/lib/index.tcl +++ b/lib/index.tcl @@ -13,7 +13,8 @@ proc update_indexinfo {msg pathList after} { if {$batch > 25} {set batch 25} ui_status [format \ - "$msg... %i/%i files (%.2f%%)" \ + "%s... %i/%i files (%.2f%%)" \ + $msg \ $update_index_cp \ $totalCnt \ 0.0] @@ -68,7 +69,8 @@ proc write_update_indexinfo {fd pathList totalCnt batch msg after} { } ui_status [format \ - "$msg... %i/%i files (%.2f%%)" \ + "%s... %i/%i files (%.2f%%)" \ + $msg \ $update_index_cp \ $totalCnt \ [expr {100.0 * $update_index_cp / $totalCnt}]] @@ -86,7 +88,8 @@ proc update_index {msg pathList after} { if {$batch > 25} {set batch 25} ui_status [format \ - "$msg... %i/%i files (%.2f%%)" \ + "%s... %i/%i files (%.2f%%)" \ + $msg \ $update_index_cp \ $totalCnt \ 0.0] @@ -145,7 +148,8 @@ proc write_update_index {fd pathList totalCnt batch msg after} { } ui_status [format \ - "$msg... %i/%i files (%.2f%%)" \ + "%s... %i/%i files (%.2f%%)" \ + $msg \ $update_index_cp \ $totalCnt \ [expr {100.0 * $update_index_cp / $totalCnt}]] @@ -163,7 +167,8 @@ proc checkout_index {msg pathList after} { if {$batch > 25} {set batch 25} ui_status [format \ - "$msg... %i/%i files (%.2f%%)" \ + "%s... %i/%i files (%.2f%%)" \ + $msg $update_index_cp \ $totalCnt \ 0.0] @@ -218,7 +223,8 @@ proc write_checkout_index {fd pathList totalCnt batch msg after} { } ui_status [format \ - "$msg... %i/%i files (%.2f%%)" \ + "%s... %i/%i files (%.2f%%)" \ + $msg \ $update_index_cp \ $totalCnt \ [expr {100.0 * $update_index_cp / $totalCnt}]] -- cgit v0.10.2-6-g49f6 From cff93397ab185898fd93b6a260cc6f3068c4ac30 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Sat, 8 Sep 2007 23:47:00 -0400 Subject: git-gui: Disable Tk send in all git-gui sessions The Tk designers blessed us with the "send" command, which on X11 will allow anyone who can connect to your X server to evaluate any Tcl code they desire within any running Tk process. This is just plain nuts. If git-gui wants someone running Tcl code within it then would ask someone to supply that Tcl code to it; waiting for someone to drop any random Tcl code into us is not fantastic idea. By renaming send to the empty name the procedure will be removed from the global namespace and Tk will stop responding to random Tcl evaluation requests sent through the X server. Since there is no facility to filter these requests it is unlikely that we will ever consider enabling this command. Signed-off-by: Shawn O. Pearce diff --git a/git-gui.sh b/git-gui.sh index 44977aa..6d67609 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -42,6 +42,8 @@ if {[catch {package require Tcl 8.4} err] exit 1 } +rename send {} ; # What an evil concept... + ###################################################################### ## ## enable verbose loading? -- cgit v0.10.2-6-g49f6 From c63fe3b2dc90120a4bdba7194f92efc2f3c342ed Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Sat, 8 Sep 2007 23:05:43 -0400 Subject: git-gui: Avoid use of libdir in Makefile Dmitry V. Levin pointed out that on GNU linux libdir is often used in Makefiles to mean "/usr/lib" or "/usr/lib64", a directory that is meant to hold platform-specific binary files. Using a different libdir meaning here in git-gui's Makefile breaks idomatic expressions like rpm specifile "make libdir=%_libdir". Originally I asked that the git.git Makefile undefine libdir before it calls git-gui's own Makefile but it turns out this is very hard to do, if not impossible. Renaming our libdir to gg_libdir resolves this case with a minimum amount of fuss on our part. Signed-off-by: Shawn O. Pearce diff --git a/Makefile b/Makefile index 1bac6fe..f11cf26 100644 --- a/Makefile +++ b/Makefile @@ -76,8 +76,8 @@ SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH)) TCL_PATH_SQ = $(subst ','\'',$(TCL_PATH)) TCLTK_PATH_SQ = $(subst ','\'',$(TCLTK_PATH)) -libdir ?= $(sharedir)/git-gui/lib -libdir_SQ = $(subst ','\'',$(libdir)) +gg_libdir ?= $(sharedir)/git-gui/lib +libdir_SQ = $(subst ','\'',$(gg_libdir)) exedir = $(dir $(gitexecdir))share/git-gui/lib exedir_SQ = $(subst ','\'',$(exedir)) @@ -126,7 +126,7 @@ TRACK_VARS = \ $(subst ','\'',TCL_PATH='$(TCL_PATH_SQ)') \ $(subst ','\'',TCLTK_PATH='$(TCLTK_PATH_SQ)') \ $(subst ','\'',gitexecdir='$(gitexecdir_SQ)') \ - $(subst ','\'',libdir='$(libdir_SQ)') \ + $(subst ','\'',gg_libdir='$(libdir_SQ)') \ #end TRACK_VARS GIT-GUI-VARS: .FORCE-GIT-GUI-VARS -- cgit v0.10.2-6-g49f6