Your message dated Mon, 19 Feb 2018 22:23:59 +0000
with message-id <e1entqp-0003jl...@fasolo.debian.org>
and subject line Bug#890813: fixed in faketime 0.9.7-2
has caused the Debian Bug report #890813,
regarding faketime does not work correctly on Alpha
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.)


-- 
890813: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=890813
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
--- Begin Message ---
Package: faketime
Version: 0.9.7-1
Severity: important
Tags: patch

The faketime package fails to work correctly on the Alpha
architecture. This failure of faketime to work correctly is the
reason for the mbedtls FTBFS, which uses faketime in its test
suite [1].

Consider the following test program (which I call "time-test"):

#include <stdio.h>
#include <sys/time.h>
#include <unistd.h>

int main(void)
{
    struct timeval tv;

    for (int j=0; j<5; j++) {
        usleep(10000);
        gettimeofday(&tv, NULL);
        printf("s=%ld    us=%ld\n", tv.tv_sec, tv.tv_usec);
    }
    return 0;
}


When run it produces output like:

s=1519025990    us=838219
s=1519025990    us=848965
s=1519025990    us=859711
s=1519025990    us=870456
s=1519025990    us=881202

But when run as (with faketime built in its source directory):

LD_PRELOAD=faketime-0.9.7/src/libfaketime.so.1 FAKETIME="-1d" ./time-test

the output is:

s=2199023743604    us=0
s=2199023657204    us=0
s=2199023570804    us=0
s=2199023484404    us=0
s=2199023398004    us=0

which is definitely not correct.

The reason for the incorrect behaviour is that there are two
gettimeofday symbols in libc on Alpha and the dlsym() call to link
to the gettimeofday() is picking up the function with the wrong ABI.
I attach a patch to fix that.  Faketime built with the attached
patch works correctly and with a fixed faketime the mbedtls source
package builds to completion on Alpha.

Cheers
Michael.

[1] 
https://buildd.debian.org/status/fetch.php?pkg=mbedtls&arch=alpha&ver=2.7.0-2&stamp=1518727161&raw=0

-- System Information:
Debian Release: buster/sid
  APT prefers unreleased
  APT policy: (500, 'unreleased'), (500, 'unstable')
Architecture: alpha

Kernel: Linux 4.14.10-titan-p1+ (SMP w/3 CPU cores)
Locale: LANG=en_NZ.UTF-8, LC_CTYPE=en_NZ.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_NZ.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)
Index: faketime-0.9.7/src/libfaketime.c
===================================================================
--- faketime-0.9.7.orig/src/libfaketime.c       2018-02-19 07:57:52.000000000 
+1300
+++ faketime-0.9.7/src/libfaketime.c    2018-02-19 08:23:51.592643229 +1300
@@ -1658,7 +1658,11 @@
   real_lstat64 =            dlsym(RTLD_NEXT, "__lxstat64");
   real_time =               dlsym(RTLD_NEXT, "time");
   real_ftime =              dlsym(RTLD_NEXT, "ftime");
+#if defined(__alpha__) && defined(__GLIBC__)
+  real_gettimeofday =       dlvsym(RTLD_NEXT, "gettimeofday", "GLIBC_2.1");
+#else
   real_gettimeofday =       dlsym(RTLD_NEXT, "gettimeofday");
+#endif
 #ifdef FAKE_SLEEP
   real_nanosleep =          dlsym(RTLD_NEXT, "nanosleep");
   real_usleep =             dlsym(RTLD_NEXT, "usleep");
@@ -1671,7 +1675,11 @@
 #endif
 #ifdef FAKE_INTERNAL_CALLS
   real___ftime =              dlsym(RTLD_NEXT, "__ftime");
+#  if defined(__alpha__) && defined(__GLIBC__)
+  real___gettimeofday =       dlvsym(RTLD_NEXT, "__gettimeofday", "GLIBC_2.1");
+#  else
   real___gettimeofday =       dlsym(RTLD_NEXT, "__gettimeofday");
+#  endif
   real___clock_gettime  =     dlsym(RTLD_NEXT, "__clock_gettime");
 #endif
 #ifdef __APPLEOSX__

--- End Message ---
--- Begin Message ---
Source: faketime
Source-Version: 0.9.7-2

We believe that the bug you reported is fixed in the latest version of
faketime, 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 890...@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Daniel Kahn Gillmor <d...@fifthhorseman.net> (supplier of updated faketime 
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: Mon, 19 Feb 2018 14:07:10 -0800
Source: faketime
Binary: faketime libfaketime
Architecture: source
Version: 0.9.7-2
Distribution: unstable
Urgency: medium
Maintainer: Daniel Kahn Gillmor <d...@fifthhorseman.net>
Changed-By: Daniel Kahn Gillmor <d...@fifthhorseman.net>
Description:
 faketime   - Report faked system time to programs (command-line tool)
 libfaketime - Report faked system time to programs (preload library)
Closes: 890813
Changes:
 faketime (0.9.7-2) unstable; urgency=medium
 .
   * git: convert branch naming to DEP-14
   * use correct gettimeofday() on alpha (Closes: #890813)
   * d/control: use Rules-Requires-Root: no
   * d/rules: enable hardening flags
   * use CPPFLAGS to fix hardening-no-fortify-functions
Checksums-Sha1:
 b14be474d73c08ae339cd94fd4180f690ad53015 1317 faketime_0.9.7-2.dsc
 74c6875e51f8cb780746bbc5c780016720d6b99d 6132 faketime_0.9.7-2.debian.tar.xz
 bf84493a20624bb29bdc3927a30d039ced21adcf 6179 faketime_0.9.7-2_amd64.buildinfo
Checksums-Sha256:
 933bd5a5c6c9959edb208e1d380bbb6b0b872a34e3df1538be614c9a54be1322 1317 
faketime_0.9.7-2.dsc
 b507f546cb1a096c6814d769cf0cf48bcbb579fd137120794eaa996c96931be8 6132 
faketime_0.9.7-2.debian.tar.xz
 e8fd95ab1dc389939db7fc1b5d1c08c133c36d750b5bb1f40e3de66cdc94e387 6179 
faketime_0.9.7-2_amd64.buildinfo
Files:
 17fd5b75d259ab663fc891398fcf98de 1317 utils optional faketime_0.9.7-2.dsc
 b0a3fcc0aa459be6adf3ebb7cf706f33 6132 utils optional 
faketime_0.9.7-2.debian.tar.xz
 811cc12ac95c9b7cf594487e48a046a3 6179 utils optional 
faketime_0.9.7-2_amd64.buildinfo

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

iHUEARYKAB0WIQTTaP514aqS9uSbmdJsHx7ezFD6UwUCWotLEAAKCRBsHx7ezFD6
U4C1AP9kw53mQO/s23AP4PvCprfO5a5MHD/xzuSGFN8LfiiojgEApWEoRiEwhFD3
BBsXzNDas8NEhY2hi4de8rKROTqJfwg=
=/ksE
-----END PGP SIGNATURE-----

--- End Message ---

Reply via email to