Bug#900126: libgit2: Testsuite failures on 32-bit targets with 64-bit file offsets

John Paul Adrian Glaubitz <[email protected]>
Newsgroups gmane.linux.debian.ports.mips
Message-ID <152734157867.30204.16898955505264975200.reportbug__35898.4138620601$1527341903$gmane$org@z6.physik.fu-berlin.de>
Source: libgit2
Version: 0.23.1-1
Severity: serious
Tags: patch upstream
Justification: fails to build from source
User: [email protected]
Usertags: mips

Hi!

Thanks for merging my patch to fix the alignment issue reported
in #900059. There is, however, an additional problem with libgit2
which causes the testsuite to fail on 32-bit systems [1]:

core::buffer..........................*** stack smashing detected ***: <unknown> terminated

3/3 Test #3: libgit2_clar-ssh .................***Exception: Child aborted  3.47 sec
Loaded 343 suites: 
Started (test status codes: OK='.' FAILURE='F' SKIPPED='S')

Since this issue is not visible in the git master branch of libgit2,
I assumed that this must have been fixed in the meantime. And, in
fact there is pull request which addresses this problem [2].

The fix is trivial and I can confirm it fixes the testsuite for me
on mipsel.

Please include the attached patch in the next upload.

Adrian

> [1] https://buildd.debian.org/status/fetch.php?pkg=libgit2&arch=i386&ver=0.27.0%2Bdfsg.1-0.3&stamp=1527339147&raw=0
> [2] https://github.com/libgit2/libgit2/pull/4631

--
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - [email protected]
`. `'   Freie Universitaet Berlin - [email protected]
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
0001-fixed-stack-smashing-due-to-wrong-size-of-struct-sta.patch (text/plain, 978 B)
>From fac7eac451f99f722b54e7cd8761926837dd0fa5 Mon Sep 17 00:00:00 2001
From: Andreas Baumann <[email protected]>
Date: Thu, 19 Apr 2018 15:21:52 +0200
Subject: [PATCH] fixed stack smashing due to wrong size of struct stat on the
 stack on 32-bit systems with 64-bit file descriptor offsets enabled (added
 -D_FILE_OFFSET_BITS=64 when compiling the test suite)

---
 tests/CMakeLists.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 775f33f2d..e73e7237c 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -9,6 +9,7 @@ SET(CLAR_FIXTURES "${CMAKE_CURRENT_SOURCE_DIR}/resources/")
 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)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.