coreutils: fix build with 64bit time_t on 32bit arches
A message that is not in the archive (sent off-list or not yet received): [email protected]
ping
Quoted 57 lines · Andr? Draszik
From: André Draszik <[email protected]>
Quoted 7 lines
../../coreutils-6.9/lib/mktime.c: In function 'ydhms_diff':../../coreutils-6.9/lib/mktime.c:105:52: error: size of array 'a' is negative
105 | #defineverify(name, assertion)struct name { char a[(assertion) ? 1 : -1]; }
| ^../../coreutils-6.9/lib/mktime.c:168:3: note: in expansion of macro 'verify'168 | verify (long_int_year_and_yday_are_wide_enough, | ^~~~~~coreutils tries to determine of
mktime()from the c-library works fine, but when cross-compiling, it unconditionally assumes buggy behaviour, in which case it will use its own replacement implementation. These basically are tests for (g)libc implementation bugs that have existed in ancient times but aren't relevant anymore.The alternative implementation makes various assumptions which don't hold true (and doesn't compile anymore). While more recent versions of coreutils have fixed those assumptions, it's quite hard to update the code here without potential licensing issues.
Given
mktime()works fine in musl and glibc these days, we can work-around the issues by simply relying on the c-librariesmktime()implementation, avoiding all problems with coreutils' alternative implementation.I've veryfied this by running the tests both on my musl target, and my glibc (v2.29) host.
This also reduces code-size slightly.
The
ac_cv_func_working_mktimevariable here corresponds to thegl_cv_func_working_mktimevariable in more recent versions of coreutils (gnulib), which is being set in oe-core in meta/site.Signed-off-by André Draszik <[email protected]>--- recipes-core/coreutils/coreutils_6.9.bb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)recipes-core/coreutils/coreutils_6.9.bb +3
-1@@ -33,7 +33,9 @@ SRC_URI[md5sum] = "c9607d8495f16e98906e7ed2d9751a06" SRC_URI[sha256sum] = "89c2895ad157de50e53298b22d91db116ee4e1dd3fdf4019260254e2e31497b0" EXTRA_OECONF += "ac_cv_func_getgroups_works=yes \ - ac_cv_func_strcoll_works=yes" + ac_cv_func_strcoll_works=yes \ + ac_cv_func_working_mktime=yes \ + " # acl is not a default feature #
A message that is not in the archive (sent off-list or not yet received): [email protected]
ping.
meta-gplv2 is broken against OE/master without this...
A.
Quoted 62 lines · André Draszik
ping
Quoted 57 lines · Andr? Draszik
From: André Draszik <[email protected]>
Quoted 7 lines
../../coreutils-6.9/lib/mktime.c: In function 'ydhms_diff':../../coreutils-6.9/lib/mktime.c:105:52: error: size of array 'a' is negative
105 | #defineverify(name, assertion)struct name { char a[(assertion) ? 1 : -1]; }
| ^../../coreutils-6.9/lib/mktime.c:168:3: note: in expansion of macro 'verify'168 | verify (long_int_year_and_yday_are_wide_enough, | ^~~~~~coreutils tries to determine of
mktime()from the c-library works fine, but when cross-compiling, it unconditionally assumes buggy behaviour, in which case it will use its own replacement implementation. These basically are tests for (g)libc implementation bugs that have existed in ancient times but aren't relevant anymore.The alternative implementation makes various assumptions which don't hold true (and doesn't compile anymore). While more recent versions of coreutils have fixed those assumptions, it's quite hard to update the code here without potential licensing issues.
Given
mktime()works fine in musl and glibc these days, we can work-around the issues by simply relying on the c-librariesmktime()implementation, avoiding all problems with coreutils' alternative implementation.I've veryfied this by running the tests both on my musl target, and my glibc (v2.29) host.
This also reduces code-size slightly.
The
ac_cv_func_working_mktimevariable here corresponds to thegl_cv_func_working_mktimevariable in more recent versions of coreutils (gnulib), which is being set in oe-core in meta/site.Signed-off-by André Draszik <[email protected]>--- recipes-core/coreutils/coreutils_6.9.bb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)recipes-core/coreutils/coreutils_6.9.bb +3
-1@@ -33,7 +33,9 @@ SRC_URI[md5sum] = "c9607d8495f16e98906e7ed2d9751a06" SRC_URI[sha256sum] = "89c2895ad157de50e53298b22d91db116ee4e1dd3fdf4019260254e2e31497b0" EXTRA_OECONF += "ac_cv_func_getgroups_works=yes \ - ac_cv_func_strcoll_works=yes" + ac_cv_func_strcoll_works=yes \ + ac_cv_func_working_mktime=yes \ + " # acl is not a default feature #