[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#709781: libglib2.0-0: g_date_time_new_from_timeval_utc() fails on sparc



Package: libglib2.0-0
Version: 2.36.1-2build1
Severity: important

While investigating a FTBFS of telepathy-glib on sparc
(<http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=709776>), I tracked the
problem down to GDateTime creation failing.

On i386 and amd64, the attached test program outputs:

> ** Message: in: 1369481139.090801
> ** Message: GTimeVal iso : 2013-05-25T11:25:39.090801Z
> ** Message: GDateTime iso: 2013-05-25 11:25:39
> ** Message: out: 1369481139.090801

On sparc, it fails:

> ** Message: in: 1369481139.090801
> **
> ERROR:datetime.c:11:main: assertion failed: (dt != NULL)
> Aborted

(The original test in telepathy-glib used "the time now" and so was
non-deterministic, but this test uses a hard-coded GTimeVal so
it should be deterministic.)

Breaking on the internal function g_date_time_from_instant (which requires
libglib2.0-0-dbg) yields this on amd64:

> g_date_time_from_instant (tz=tz@entry=0x602040, instant=63505164339090801)

(and repeating the "instant" calculation with arbitrary-precision arithmetic
in Python produces the same thing) but on sparc, instant appears to be
mis-computed for some reason:

> g_date_time_from_instant (tz=0xffffd71c, instant=137439021280)

This is causing telepathy-glib to FTBFS with a test failure. The GDateTime
tests in GLib also failed on sparc, but for some reason the failure is
ignored (I'm not sure whether that's deliberate or accidental).

I'll set this particular telepathy-glib test to be skipped on sparc for now.

Tested on the porterbox smetana.debian.org; the package versions below are
from there.

-- System Information:
Debian Release: 7.0
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: sparc

Kernel: Linux 2.6.32-5-sparc64-smp (SMP w/1 CPU core)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash

Versions of packages libglib2.0-0 depends on:
ii  libc6              2.17-3
ii  libffi6            3.0.13-4
ii  libpcre3           1:8.31-2
ii  libselinux1        2.1.13-2
ii  multiarch-support  2.13-38
ii  zlib1g             1:1.2.8.dfsg-1

Versions of packages libglib2.0-0 recommends:
ii  libglib2.0-data   2.36.1-2build1
ii  shared-mime-info  1.0-1+b1

libglib2.0-0 suggests no packages.

-- no debconf information
/* gcc `pkg-config --cflags --libs glib-2.0` datetime.c */

#include <glib.h>

int
main (int argc, char **argv)
{
	GTimeVal tv = { 1369481139L, 90801L };
	GDateTime *dt;
	
	g_message ("in: %ld.%06ld", tv.tv_sec, tv.tv_usec);
	dt = g_date_time_new_from_timeval_utc (&tv);
	g_assert (dt != NULL);
	/* yes I know this leaks memory */
	g_message ("GTimeVal iso : %s", g_time_val_to_iso8601 (&tv));
	g_message ("GDateTime iso: %s", g_date_time_format (dt, "%Y-%m-%d %H:%M:%S"));
	if (!g_date_time_to_timeval (dt, &tv))
		g_message ("out of range for a timeval apparently");
	else
		g_message ("out: %ld.%06ld", tv.tv_sec, tv.tv_usec);
	return 0;
}

Reply to: