Your message dated Sat, 26 May 2018 12:19:56 +0000
with message-id <e1fmyau-000glx...@fasolo.debian.org>
and subject line Bug#900059: fixed in libgit2 0.27.0+dfsg.1-0.3
has caused the Debian Bug report #900059,
regarding libgit2: Testsuite failure due to alignment-related crashes
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact ow...@bugs.debian.org
immediately.)


-- 
900059: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=900059
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
--- Begin Message ---
Source: libgit2
Version: 0.23.1-1
Severity: serious
Tags: patch upstream
Justification: fails to build from source
User: debian-sp...@lists.debian.org
Usertags: sparc64

Hello!

libgit2's testsuite fails because of an unaligned access which affects
both mipsel (and mips64el in experimental) as well as sparc64:

Test project /<<BUILDDIR>>/libgit2-0.26.0+dfsg.1/build-debian-release
    Start 1: libgit2_clar
    Start 2: libgit2_clar-cred_callback
    Start 3: libgit2_clar-proxy_credentials_in_url
    Start 4: libgit2_clar-proxy_credentials_request
1/4 Test #3: libgit2_clar-proxy_credentials_in_url ....   Passed    0.07 sec
2/4 Test #2: libgit2_clar-cred_callback ...............   Passed    0.07 sec
3/4 Test #4: libgit2_clar-proxy_credentials_request ...   Passed    0.07 sec
4/4 Test #1: libgit2_clar .............................***Exception: Bus error 
60.88 sec
Loaded 338 suites: 
Started

I have written a patch to address this issue which I have sent upstream [1]. I
am attaching the patch to this bug report so you can include it with the
Debian package.

However, I think you will have to update the libgit2 version in experimental
anyway as there are still some unrelated testsuite failures in that version
which are not caused by unaligned access.

Adrian

> [1] https://github.com/libgit2/libgit2/pull/4655

--
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaub...@debian.org
`. `'   Freie Universitaet Berlin - glaub...@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
>From 2ce5a21f46e78cdc3f04cb783e372828494199d5 Mon Sep 17 00:00:00 2001
From: John Paul Adrian Glaubitz <glaub...@physik.fu-berlin.de>
Date: Fri, 25 May 2018 01:41:33 +0200
Subject: [PATCH] index: Fix alignment issues in write_disk_entry()

In order to avoid alignment issues on certain target architectures,
it is necessary to use memcpy() when modifying elements of a struct
inside a buffer returned by git_filebuf_reserve().
---
 src/index.c | 42 +++++++++++++++++++++---------------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/src/index.c b/src/index.c
index a867547fb..3dcb6dde7 100644
--- a/src/index.c
+++ b/src/index.c
@@ -2605,7 +2605,7 @@ static bool is_index_extended(git_index *index)
 static int write_disk_entry(git_filebuf *file, git_index_entry *entry, const 
char *last)
 {
        void *mem = NULL;
-       struct entry_short *ondisk;
+       struct entry_short ondisk;
        size_t path_len, disk_size;
        int varint_len = 0;
        char *path;
@@ -2633,9 +2633,7 @@ static int write_disk_entry(git_filebuf *file, 
git_index_entry *entry, const cha
        if (git_filebuf_reserve(file, &mem, disk_size) < 0)
                return -1;
 
-       ondisk = (struct entry_short *)mem;
-
-       memset(ondisk, 0x0, disk_size);
+       memset(mem, 0x0, disk_size);
 
        /**
         * Yes, we have to truncate.
@@ -2647,30 +2645,32 @@ static int write_disk_entry(git_filebuf *file, 
git_index_entry *entry, const cha
         *
         * In 2038 I will be either too dead or too rich to care about this
         */
-       ondisk->ctime.seconds = htonl((uint32_t)entry->ctime.seconds);
-       ondisk->mtime.seconds = htonl((uint32_t)entry->mtime.seconds);
-       ondisk->ctime.nanoseconds = htonl(entry->ctime.nanoseconds);
-       ondisk->mtime.nanoseconds = htonl(entry->mtime.nanoseconds);
-       ondisk->dev = htonl(entry->dev);
-       ondisk->ino = htonl(entry->ino);
-       ondisk->mode = htonl(entry->mode);
-       ondisk->uid = htonl(entry->uid);
-       ondisk->gid = htonl(entry->gid);
-       ondisk->file_size = htonl((uint32_t)entry->file_size);
+       ondisk.ctime.seconds = htonl((uint32_t)entry->ctime.seconds);
+       ondisk.mtime.seconds = htonl((uint32_t)entry->mtime.seconds);
+       ondisk.ctime.nanoseconds = htonl(entry->ctime.nanoseconds);
+       ondisk.mtime.nanoseconds = htonl(entry->mtime.nanoseconds);
+       ondisk.dev = htonl(entry->dev);
+       ondisk.ino = htonl(entry->ino);
+       ondisk.mode = htonl(entry->mode);
+       ondisk.uid = htonl(entry->uid);
+       ondisk.gid = htonl(entry->gid);
+       ondisk.file_size = htonl((uint32_t)entry->file_size);
 
-       git_oid_cpy(&ondisk->oid, &entry->id);
+       git_oid_cpy(&ondisk.oid, &entry->id);
 
-       ondisk->flags = htons(entry->flags);
+       ondisk.flags = htons(entry->flags);
 
        if (entry->flags & GIT_IDXENTRY_EXTENDED) {
-               struct entry_long *ondisk_ext;
-               ondisk_ext = (struct entry_long *)ondisk;
-               ondisk_ext->flags_extended = htons(entry->flags_extended &
+               struct entry_long ondisk_ext;
+               memcpy(&ondisk_ext, &ondisk, sizeof(struct entry_short));
+               ondisk_ext.flags_extended = htons(entry->flags_extended &
                        GIT_IDXENTRY_EXTENDED_FLAGS);
-               path = ondisk_ext->path;
+               memcpy(mem, &ondisk_ext, sizeof(struct entry_long));
+               path = ((struct entry_long*)mem)->path;
                disk_size -= offsetof(struct entry_long, path);
        } else {
-               path = ondisk->path;
+               memcpy(mem, &ondisk, sizeof(struct entry_short));
+               path = ((struct entry_short*)mem)->path;
                disk_size -= offsetof(struct entry_short, path);
        }
 
-- 
2.17.0


--- End Message ---
--- Begin Message ---
Source: libgit2
Source-Version: 0.27.0+dfsg.1-0.3

We believe that the bug you reported is fixed in the latest version of
libgit2, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 900...@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Pirate Praveen <prav...@debian.org> (supplier of updated libgit2 package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmas...@ftp-master.debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Sat, 26 May 2018 17:31:32 +0530
Source: libgit2
Binary: libgit2-dev libgit2-27
Architecture: source
Version: 0.27.0+dfsg.1-0.3
Distribution: experimental
Urgency: medium
Maintainer: Russell Sim <russell....@gmail.com>
Changed-By: Pirate Praveen <prav...@debian.org>
Description:
 libgit2-27 - low-level Git library
 libgit2-dev - low-level Git library (development files)
Closes: 900059
Changes:
 libgit2 (0.27.0+dfsg.1-0.3) experimental; urgency=medium
 .
   * Non-maintainer upload.
   * Don't add mbedtls in pkgconfig file (upstream patch)
   * Fix test failure due to alignment-related crashes (Closes: #900059)
Checksums-Sha1:
 813544173e86d00640132953f1fda92057c17a86 2082 libgit2_0.27.0+dfsg.1-0.3.dsc
 3eeadb30e054adabaded131734a2e9cfe5aeb606 21204 
libgit2_0.27.0+dfsg.1-0.3.debian.tar.xz
 a2bf3371a537e45185a23197c075bd66d2ef3658 6826 
libgit2_0.27.0+dfsg.1-0.3_source.buildinfo
Checksums-Sha256:
 868d20298b165fdedcde9df2a179f26fd49ff505c032e455f4cbd32c8c9dd00d 2082 
libgit2_0.27.0+dfsg.1-0.3.dsc
 ee857e2ab812266eb94d3287c3028c0b2709edf932be9bf6dff17fb7b08910fe 21204 
libgit2_0.27.0+dfsg.1-0.3.debian.tar.xz
 29d1a5d9efa3e32b25c23a9a555f890a4c96fd8f93e481a7f142713e1318f635 6826 
libgit2_0.27.0+dfsg.1-0.3_source.buildinfo
Files:
 a01d2e842fd98b1ed2d4d36f65a21aa7 2082 libs optional 
libgit2_0.27.0+dfsg.1-0.3.dsc
 c7c0b37b8cbf7706dc5346abfa774501 21204 libs optional 
libgit2_0.27.0+dfsg.1-0.3.debian.tar.xz
 2cef2560fa193f505dca468477c523d1 6826 libs optional 
libgit2_0.27.0+dfsg.1-0.3_source.buildinfo

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEKnl0ri/BUtd4Z9pKzh+cZ0USwioFAlsJTVoACgkQzh+cZ0US
wioWWBAAlMZpEoQhoIVx9LIA2RDGart5C663yRMpX/cBzUszMRhHLFVO46XbfO6o
g1GO9PdH1FxiGsQybGVjAJRY7xInXCvew8rfn99h6/einXnaPd72cp2KrNxpERxb
aC99OOtszARuCpP6UikHrTKtkfKJCsMJS1gzW6QamjCjy2xJBXCRjEEH5frtaYg/
1MvviZun0Yegv+3Dz+reERO5GWMyMoHRd31X0/Rdia0vt8X3i+DmNE/0QXLbhXM9
rCqEQcpdoLHFraqpJxVr+9jOv3V+lHG8oNnhURldCcdNqrCdPGwpxzrjjsB7Mhpg
ZzvSW78cqBnm0oW30SWU0dBBeUIb4ZXHUdz0RuUhBS++Wne8UJDvUjB2rhtvnLCY
40JYJqFnr+xO8KWLqCiEzae8ORs14JNACKYBT+/3BrNn3oshoPSn5RJwCKE26/LD
+Cu+R4Dikr3JYccMQEaMfW+GSvlBfY50ErKiQ52EYWMMZSfgHCUuGLPLQASx/nU9
vqte1Rueshx5tjISlkhKx0RyTdJOJqF18LizDnkEQSgw8BAEohloTLpoqqn203q4
bv9Rc26HXRPRpuPxKaaAsjlbzNCm+r40tIt6h7bTIDg4PlgbdK3DoMxghZjhzgHv
RLivbBcUq1TVjsDV1mbrymuOFJhB+zVBcNp/7Toqr/rlI2/7YME=
=YuiJ
-----END PGP SIGNATURE-----

--- End Message ---

Reply via email to