Subject: [alpine-aports] [PATCH] main/tar: avoid using broken code in cross build

From: Mobile Stream <[email-masked]>
Date: Fri, 10 Aug 2018 16:46:25 +0300

The tar cross-compile logic fails to detect no-clobber properties of gettimeofday and tzset functions and replaces them and some dependent calls with the code from the bundled GNU portability library (tar-130/gnu/).

This includes the apparently broken rpl_gmtime/rpl_localtime code from tar-130/gnu/localtime-buffer.c which on armhf ends up as:

0004578c <rpl_gmtime>:
   4578c:       e92d4010        push    {r4, lr}
   45790:       ebfffffd        bl      4578c <rpl_gmtime>
   45794:       e59f3018        ldr     r3, [pc, #24]   ; 457b4 <rpl_gmtime+0x28>
   45798:       e59f2018        ldr     r2, [pc, #24]   ; 457b8 <rpl_gmtime+0x2c>
   4579c:       e08f3003        add     r3, pc, r3
   457a0:       e5931000        ldr     r1, [r3]
   457a4:       e08f2002        add     r2, pc, r2
   457a8:       e1510002        cmp     r1, r2
   457ac:       05830000        streq   r0, [r3]
   457b0:       e8bd8010        pop     {r4, pc}
   457b4:       0002ff1c        .word   0x0002ff1c
   457b8:       00030858        .word   0x00030858

The proper fix should be in gnulib (i.e. recognize musl libc as done with glibc) however the APKBUILD change is simpler and easier to remove when/if upstream fixes the problem.

---
 main/tar/APKBUILD | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/main/tar/APKBUILD b/main/tar/APKBUILD
index 02220a1652..cd710503be 100644
--- a/main/tar/APKBUILD
+++ b/main/tar/APKBUILD
@@ -29,6 +29,8 @@ prepare() {
 
 build() {
        cd "$_builddir"
+       gl_cv_func_gettimeofday_clobber=no \
+       gl_cv_func_tzset_clobber=no \
        ./configure \
                --build=$CBUILD \
                --host=$CHOST \
-- 
2.18.0

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---