[Bug 2060805] Re: strace fails to build it's tests on arm-linux-gnueabihf with 64bit time_t

Christian Ehrhardt  2060805 at bugs.launchpad.net
Thu Apr 18 10:07:44 UTC 2024


Per check in ubuntu-release no one started to look into this so far.
I'm unsure if I can complete it with all the other release related things, but I'll leave what I've found here.


Strace defines an own time type in [1]

$ cat tests/kernel_old_timespec.h
...
typedef struct {
# if SIZEOF_KERNEL_LONG_T == 4 || defined LINUX_MIPSN32
	int
# else
	long long
# endif
	tv_sec, tv_nsec;
} kernel_old_timespec_t;
...


The conflict now is that on 32bit that boils down to int on e.g. armhf, but with 64 bit time_t that no more matches.
Due to that some assignments of ... (time_t) 0x1234LL can break if the static value is exceeding int.

Many places then later changed in [2] to not use time_t anymore and now
usually make it use typeof.

But the same pattern is yet unfixed in a few more spots in the tests:
   tests/mq_sendrecv.c:198:		.tv_sec = (time_t) 0xdeadfacebeeff00dLL,
   tests/mq_sendrecv.c:202:		.tv_sec = (time_t) 0x7ea1fade7e57faceLL,
   tests/recvmmsg-timeout.c:60:	ts->tv_sec = (time_t) 0xcafef00ddeadbeefLL;
   tests/xselect.c:216:	tv_in.tv_sec = (time_t) 0xcafef00ddeadbeefLL;
   tests/xutimes.c:89:	tv[1].tv_sec = (time_t) 0xcafef00ddeadbeefLL;

The first of them in build is in xselect and breaks the build via
../../tests/xselect.c: In function ‘main’:
../../tests/xselect.c:216:24: error: overflow in conversion from ‘long long int’ to ‘kernel_long_t’ {aka ‘long int’} changes value from ‘-3819351491602432273’ to ‘-559038737’ [-Werror=overflow]
  216 |         tv_in.tv_sec = (time_t) 0xcafef00ddeadbeefLL;
      |                        ^

Without rewriting how time is handled there, and probably failing by not
understanding enough of the intricacies of the program and the tests,
how about just applying the same fix to the other cases that are left.
Trying that as a first angle of attack ...


[1]: https://github.com/strace/strace/commit/891ab42b7015037520a01042201d4ddc548c266d
[2]: https://github.com/strace/strace/commit/7178658ead8ccfe196694dc5434f0f37db8746b4

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to strace in Ubuntu.
https://bugs.launchpad.net/bugs/2060805

Title:
  strace fails to build it's tests on arm-linux-gnueabihf with 64bit
  time_t

Status in strace:
  New
Status in strace package in Ubuntu:
  New

Bug description:
  strace fails to build it's tests on arm-linux-gnueabihf with 64bit
  time_t

To manage notifications about this bug go to:
https://bugs.launchpad.net/strace/+bug/2060805/+subscriptions




More information about the foundations-bugs mailing list