This patch for zziplib (0.13.49) fixes a bus error on Linux/SPARC. Since SPARC machines are big endian and zip files are stored in little endian, zziplib needs to do byte swapping. On GNU/Linux this is usually done using glibc's bswap_{16,32,64} functions but in this case calling one of these functions triggers a bus error. This patch makes zziplib use it's own byte swapping functions (which do work) on Linux/SPARC instead of glibc's. To reproduce it run (in the src dir): cd Linux_*_sparc64.d && ./bins/zzcat test/test/README or make check Problem found by: Ferris McCormick Patch written by: Friedrich Oslage with advice from: Mike Frysinger External references: https://bugs.gentoo.org/show_bug.cgi?id=239472 --- zzip/fetch.c +++ zzip/fetch.c @@ -17,7 +17,7 @@ #include #if defined ZZIP_WORDS_BIGENDIAN && \ - defined bswap_16 && defined bswap_32 && defined bswap_64 + defined bswap_16 && defined bswap_32 && defined bswap_64 && !defined(__sparc__) # define __ZZIP_GET16(__p) bswap_16(*(uint16_t*)(__p)) # define __ZZIP_GET32(__p) bswap_32(*(uint32_t*)(__p)) # define __ZZIP_SET16(__p,__x) (*(uint16_t*)(__p) = bswap_16((uint16_t)(__x))) --- zzip/fetch.h +++ zzip/fetch.h @@ -24,7 +24,7 @@ extern uint64_t __zzip_get64(zzip_byte_t * s) __zzip_attribute__((const)); extern void __zzip_set64(zzip_byte_t * s, uint64_t v); #ifdef ZZIP_WORDS_BIGENDIAN -# if defined bswap_16 && defined bswap_32 && defined bswap_64 /* i.e. linux */ +# if defined bswap_16 && defined bswap_32 && defined bswap_64 && !defined(__sparc__) /* i.e. linux */ # define ZZIP_GET16(__p) bswap_16(*(uint16_t*)(__p)) # define ZZIP_GET32(__p) bswap_32(*(uint32_t*)(__p)) # define ZZIP_GET64(__p) bswap_64(*(uint64_t*)(__p))