From a56bdf6fbb9c7b8913b77543b2afa19f3a4a44b1 Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Mon, 18 Dec 2006 11:53:10 +0000 Subject: [PATCH] Added two upstream patches to fix a segfault and an infinite loop. 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 | 8 ++++++ debian/patches/00list | 3 +++ debian/patches/infiniteloop.dpatch | 36 +++++++++++++++++++++++++++ debian/patches/splitview.dpatch | 40 ++++++++++++++++++++++++++++++ debian/rules | 8 +++--- 5 files changed, 92 insertions(+), 3 deletions(-) create mode 100644 debian/patches/00list create mode 100644 debian/patches/infiniteloop.dpatch create mode 100644 debian/patches/splitview.dpatch diff --git a/debian/changelog b/debian/changelog index 3eaff6e..c3a50c8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +tig (0.5-2) unstable; urgency=medium + + * Added two upstream patches by Jonas Fonseca : + - Fix a segfault when navigating in tree mode (Closes: #403565). + - Fix an infinite loop. + + -- Sebastian Harl 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 index 0000000..766d9c0 --- /dev/null +++ b/debian/patches/00list @@ -0,0 +1,3 @@ +infiniteloop.dpatch +splitview.dpatch + diff --git a/debian/patches/infiniteloop.dpatch b/debian/patches/infiniteloop.dpatch new file mode 100644 index 0000000..7a7319e --- /dev/null +++ b/debian/patches/infiniteloop.dpatch @@ -0,0 +1,36 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## infiniteloop.dpatch by Jonas Fonseca +## +## 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 index 0000000..57c0f16 --- /dev/null +++ b/debian/patches/splitview.dpatch @@ -0,0 +1,40 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## splitview.dpatch by Jonas Fonseca +## +## 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 , Josh Triplett +## DP: and Jamey Sharp + +@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; + diff --git a/debian/rules b/debian/rules index 8af679a..91686f0 100755 --- a/debian/rules +++ b/debian/rules @@ -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 -- 2.30.2