Package: tar
Version: 1.34+dfsg-1.1
Tags: hppa, patch, ftbfs, lfs

I wondered why tar now suddenly fails to build on those platforms.
Testcase # 151 does create files whith access dates which are outside of the 
reach for
32-bit plaforms with a default of 32-bit timestamps in glibc.
This does succeed on filesystems which support 64-bit timestamps, but
stat'ing this file from 32-bit tar executable fails like this:
+tar: dir/f2038-01-19T03\:14\:08.9: Cannot stat: Value too large for defined 
data type
(this message comes from glibc!)

Full log is here:
https://buildd.debian.org/status/fetch.php?pkg=tar&arch=hppa&ver=1.34%2Bdfsg-1.1&stamp=1670958554&raw=0

I've found, that changing the line 12 in debian/rules from
CPPFLAGS = `dpkg-buildflags --get CPPFLAGS`
to:
CPPFLAGS = `dpkg-buildflags --get CPPFLAGS` -D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64 -D__USE_TIME_BITS64
does solve the issue.

So, either please add this line, or glibc needs fixing to allow
64-bit timestamps (which it probably did in earlier versions, since
otherwise tar would have failed in the past).

Here is a trivial testcase:
1. run:
touch -d 2106-02-07T06:28:15.001 f2106-02-07T06:28:15.001

2. compile and run this program, with and without __USE_TIME_BITS64 defined:
-------------------------------------------------------------
#define _FILE_OFFSET_BITS 64
#define _LARGEFILE_SOURCE
// #define __USE_TIME_BITS64
#include <fcntl.h>
#include <sys/stat.h>
#include <stdio.h>
#include <errno.h>
// run before starting this program: touch -d 2106-02-07T06:28:15.001 
f2106-02-07T06:28:15.001
int main(void)
{
        struct stat statbuf = { 0 };
        int ret;

        ret = fstatat(AT_FDCWD, "f2106-02-07T06:28:15.001", &statbuf, 
AT_SYMLINK_NOFOLLOW);
        fprintf(stderr, "return code %d  errno %d  st_atim.tv_sec %llx\n", ret, 
errno, statbuf.st_atim.tv_sec);
        return ret;
}
-------------------------------------------------------------

Reply via email to