From fe03ccf28ce236bded07571ffc9ab8c2c5c6e37e Mon Sep 17 00:00:00 2001 From: Ximin Luo Date: Fri, 10 Aug 2018 20:40:42 -0700 Subject: [PATCH] Totally For Reals fix the segfaults --- debian/changelog | 7 +++ debian/patches/fix-stack-smashing-error.patch | 19 ------- debian/patches/series | 1 - debian/patches/u-segfault-fix.patch | 49 +++++++++++++------ 4 files changed, 42 insertions(+), 34 deletions(-) delete mode 100644 debian/patches/fix-stack-smashing-error.patch diff --git a/debian/changelog b/debian/changelog index b1a60918f..51b8efd6d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +libgit2 (0.27.4+dfsg.1-0.1) UNRELEASED; urgency=medium + + * Non-maintainer upload. + * Totally For Reals fix the segfaults. (Closes: #904004) + + -- Ximin Luo Fri, 10 Aug 2018 20:38:32 -0700 + libgit2 (0.27.0+dfsg.1-0.9) unstable; urgency=medium * Non-maintainer upload. diff --git a/debian/patches/fix-stack-smashing-error.patch b/debian/patches/fix-stack-smashing-error.patch deleted file mode 100644 index 4eba11fab..000000000 --- a/debian/patches/fix-stack-smashing-error.patch +++ /dev/null @@ -1,19 +0,0 @@ -Description: Fix stack smashing error on 32-bit targets - Fix stack smashing due to wrong size of struct stat on the - stack on 32-bit systems with 64-bit file descriptor offsets - enabled by adding -D_FILE_OFFSET_BITS=64 when compiling the - test suite. - . -Author: Andreas Baumann -Last-Update: 2018-05-26 - ---- libgit2-0.27.0+dfsg.1.orig/tests/CMakeLists.txt -+++ libgit2-0.27.0+dfsg.1/tests/CMakeLists.txt -@@ -9,6 +9,7 @@ SET(CLAR_FIXTURES "${CMAKE_CURRENT_SOURC - SET(CLAR_PATH "${CMAKE_CURRENT_SOURCE_DIR}") - ADD_DEFINITIONS(-DCLAR_FIXTURE_PATH=\"${CLAR_FIXTURES}\") - ADD_DEFINITIONS(-DCLAR_TMPDIR=\"libgit2_tests\") -+ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=64) - - INCLUDE_DIRECTORIES(${CLAR_PATH} ${libgit2_BINARY_DIR}/src) - FILE(GLOB_RECURSE SRC_TEST ${CLAR_PATH}/*/*.c ${CLAR_PATH}/*/*.h) diff --git a/debian/patches/series b/debian/patches/series index 73de064f3..2e37319db 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -2,5 +2,4 @@ use-mbedtls.patch disable-online-tests.patch remove-mbedtls-from-pkgconfig.patch index-Fix-alignment-issues-in-write_disk_entry.patch -fix-stack-smashing-error.patch u-segfault-fix.patch diff --git a/debian/patches/u-segfault-fix.patch b/debian/patches/u-segfault-fix.patch index 0037a02a4..d9690ce07 100644 --- a/debian/patches/u-segfault-fix.patch +++ b/debian/patches/u-segfault-fix.patch @@ -1,17 +1,10 @@ -commit d1919485a5541fb3171d6fa835c7c0de41243dea Author: Edward Thomson -Date: Sun Aug 5 11:01:14 2018 +0100 +Bug: https://github.com/libgit2/libgit2/issues/4753 +Bug: https://github.com/libgit2/libgit2/pull/4754 - threads::diff: use separate git_repository objects - - Our thread policies state that we cannot re-use the `git_repository` - across threads. Our tests cannot deviate from that. - -diff --git a/tests/threads/diff.c b/tests/threads/diff.c -index 256040265..ab34b32a1 100644 --- a/tests/threads/diff.c +++ b/tests/threads/diff.c -@@ -76,26 +76,29 @@ static void free_trees(void) +@@ -76,26 +76,29 @@ static void *run_index_diffs(void *arg) { int thread = *(int *)arg; @@ -46,7 +39,7 @@ index 256040265..ab34b32a1 100644 git_index_free(idx); break; } -@@ -132,6 +135,7 @@ static void *run_index_diffs(void *arg) +@@ -132,6 +135,7 @@ } git_diff_free(diff); @@ -54,7 +47,7 @@ index 256040265..ab34b32a1 100644 giterr_clear(); return arg; -@@ -152,8 +156,10 @@ static void *run_index_diffs_with_modifier(void *arg) +@@ -152,8 +156,10 @@ git_diff_options opts = GIT_DIFF_OPTIONS_INIT; git_diff *diff = NULL; git_index *idx = NULL; @@ -66,7 +59,7 @@ index 256040265..ab34b32a1 100644 /* have first thread altering the index as we go */ if (thread == 0) { -@@ -176,17 +182,17 @@ static void *run_index_diffs_with_modifier(void *arg) +@@ -176,17 +182,17 @@ switch (thread & 0x03) { case 0: /* diff index to workdir */; @@ -88,7 +81,7 @@ index 256040265..ab34b32a1 100644 break; } -@@ -196,6 +202,7 @@ static void *run_index_diffs_with_modifier(void *arg) +@@ -196,6 +202,7 @@ done: git_index_free(idx); @@ -96,3 +89,31 @@ index 256040265..ab34b32a1 100644 giterr_clear(); return arg; +--- a/tests/threads/iterator.c ++++ b/tests/threads/iterator.c +@@ -12,14 +12,16 @@ + static void *run_workdir_iterator(void *arg) + { + int error = 0; ++ git_repository *repo; + git_iterator *iter; + git_iterator_options iter_opts = GIT_ITERATOR_OPTIONS_INIT; + const git_index_entry *entry = NULL; + + iter_opts.flags = GIT_ITERATOR_DONT_AUTOEXPAND; + ++ cl_git_pass(git_repository_open(&repo, git_repository_path(_repo))); + cl_git_pass(git_iterator_for_workdir( +- &iter, _repo, NULL, NULL, &iter_opts)); ++ &iter, repo, NULL, NULL, &iter_opts)); + + while (!error) { + if (entry && entry->mode == GIT_FILEMODE_TREE) { +@@ -38,6 +40,7 @@ + cl_assert_equal_i(GIT_ITEROVER, error); + + git_iterator_free(iter); ++ git_repository_free(repo); + giterr_clear(); + return arg; + }