Code

Added two upstream patches to fix a segfault and an infinite loop.
authorSebastian Harl <sh@tokkee.org>
Mon, 18 Dec 2006 11:53:10 +0000 (11:53 +0000)
committerSebastian Harl <sh@tokkee.org>
Mon, 18 Dec 2006 11:53:10 +0000 (11:53 +0000)
The patches were taken from the following commits:

 * 8b534a13651f1416d368bcc10b496ca189c2ca0c
   ("add_keybinding: always allocate the new keybinding")
 * aac64c17cd7dd8c6ceba5738cc27a7eee48b8e59
   ("Never split the tree view when opening another tree view")

Incremented Debian revision.

debian/changelog
debian/patches/00list [new file with mode: 0644]
debian/patches/infiniteloop.dpatch [new file with mode: 0644]
debian/patches/splitview.dpatch [new file with mode: 0644]
debian/rules

index 3eaff6e8a2268c066aaaa6358d377d6fd109c95d..c3a50c81d7f32af1a546d06dd91a4df9e0c3a5d2 100644 (file)
@@ -1,3 +1,11 @@
+tig (0.5-2) unstable; urgency=medium
+
+  * Added two upstream patches by Jonas Fonseca <fonseca@diku.dk>:
+    - Fix a segfault when navigating in tree mode (Closes: #403565).
+    - Fix an infinite loop.
+
+ -- Sebastian Harl <sh@tokkee.org>  Mon, 18 Dec 2006 11:38:39 +0000
+
 tig (0.5-1) unstable; urgency=low
 
   * Initial release (Closes: #389926).
diff --git a/debian/patches/00list b/debian/patches/00list
new file mode 100644 (file)
index 0000000..766d9c0
--- /dev/null
@@ -0,0 +1,3 @@
+infiniteloop.dpatch
+splitview.dpatch
+
diff --git a/debian/patches/infiniteloop.dpatch b/debian/patches/infiniteloop.dpatch
new file mode 100644 (file)
index 0000000..7a7319e
--- /dev/null
@@ -0,0 +1,36 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## infiniteloop.dpatch by Jonas Fonseca <fonseca@diku.dk>
+##
+## DP: add_keybinding: always allocate the new keybinding
+## DP:
+## DP: Fixes infinite loop repoted by Miciah. Also simply continue when wgetch
+## DP: returns ERR (-1) instead of calling get_keybinding() etc.
+
+@DPATCH@
+
+diff --git a/tig.c b/tig.c
+index aac7c4e..6c2b7d0 100644
+--- a/tig.c
++++ b/tig.c
+@@ -767,10 +767,9 @@ static struct keybinding *keybindings[AR
+ static void
+ add_keybinding(enum keymap keymap, enum request request, int key)
+ {
+-      struct keybinding *keybinding = keybindings[keymap];
++      struct keybinding *keybinding;
+-      if (!keybinding)
+-              keybinding = calloc(1, sizeof(*keybinding));
++      keybinding = calloc(1, sizeof(*keybinding));
+       if (!keybinding)
+               die("Failed to allocate keybinding");
+@@ -3532,6 +3531,8 @@ main(int argc, char *argv[])
+               /* Refresh, accept single keystroke of input */
+               key = wgetch(status_win);
++              if (key == ERR)
++                      continue;
+               request = get_keybinding(display[current_view]->keymap, key);
diff --git a/debian/patches/splitview.dpatch b/debian/patches/splitview.dpatch
new file mode 100644 (file)
index 0000000..57c0f16
--- /dev/null
@@ -0,0 +1,40 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## splitview.dpatch by Jonas Fonseca <fonseca@diku.dk>
+##
+## DP: Never split the tree view when opening another tree view.
+## DP:
+## DP: The resulting bogus display[] state ment that the blob view was not
+## DP: initialized causing segmentation faults in the redrawing code.
+## DP:
+## DP: Reported by Alexey Tourbin <at@altlinux.ru>, Josh Triplett
+## DP: <josh@freedesktop.org> and Jamey Sharp <sharpone@debian.org>
+
+@DPATCH@
+
+diff --git a/tig.c b/tig.c
+index fcfbc43..3b320e6 100644
+--- a/tig.c
++++ b/tig.c
+@@ -2580,7 +2580,7 @@ tree_read(struct view *view, char *text)
+ static bool
+ tree_enter(struct view *view, struct line *line)
+ {
+-      enum open_flags flags = display[0] == view ? OPEN_SPLIT : OPEN_DEFAULT;
++      enum open_flags flags;
+       enum request request;
+       switch (line->type) {
+@@ -2610,11 +2610,12 @@ tree_enter(struct view *view, struct lin
+               /* Trees and subtrees share the same ID, so they are not not
+                * unique like blobs. */
+-              flags |= OPEN_RELOAD;
++              flags = OPEN_RELOAD;
+               request = REQ_VIEW_TREE;
+               break;
+       case LINE_TREE_FILE:
++              flags = display[0] == view ? OPEN_SPLIT : OPEN_DEFAULT;
+               request = REQ_VIEW_BLOB;
+               break;
index 8af679ab35fe0d13a8669e9d37177ff4aaa36d49..91686f06d4421de0aa004a1360d2393a2992ad4e 100755 (executable)
@@ -14,16 +14,18 @@ else
        CFLAGS += -O2
 endif
 
+include /usr/share/dpatch/dpatch.make
+
 build: build-stamp
 
-build-stamp:
+build-stamp: patch
        dh_testdir
        
        CFLAGS="$(FLAGS)" $(MAKE) all doc
        
        touch build-stamp
 
-clean:
+clean: unpatch
        dh_testdir
        dh_testroot
        rm -f build-stamp
@@ -60,5 +62,5 @@ binary-arch: build install
        dh_builddeb
 
 binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install
+.PHONY: build clean binary-indep binary-arch binary install patch unpatch