Skip to contentSkip to conversation

coreutils: fix build with 64bit time_t on 32bit arches

PATCH In review Andr? Draszik 1 participant 4 messages Jan 10, 2020 – Jan 27, 2020 2 messages not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 coreutils: fix build with 64bit time_t on 32bit arches

From: André Draszik <[email protected]>

| ../../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 | #define verify(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-libraries mktime() 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_mktime variable here corresponds to the gl_cv_func_working_mktime variable in more recent versions of coreutils (gnulib), which is being set in oe-core in meta/site.

---
 recipes-core/coreutils/coreutils_6.9.bb | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
recipes-core/coreutils/coreutils_6.9.bb +3 -1
index 080100d..f6017ec 100644
@@ -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
 #
Signature · 1 line
2.23.0.rc1
#1 lore raw

PATCH 2/2 coreutils: set some more autotools / m4 test results

From: André Draszik <[email protected]>

While we set test outcomes in oe-core meta/site, this here uses an old version of gnulib with slightly different variable names for some of the results:

* jm_cv_func_unlink_busy_text -> gl_cv_func_unlink_busy_text
* jm_cv_have_proc_uptime -> gl_cv_have_proc_uptime
* jm_ac_cv_func_link_follows_symlink -> gl_cv_func_link_follows_symlink
* gl_cv_func_mkdir_trailing_slash_bug -> gl_cv_func_mkdir_trailing_slash_works (meaning inverted) (defaults to working in recent coreutils when cross-compiling
* gl_cv_func_rename_trailing_dest_slash_bug -> gl_cv_func_rename_slash_dst_works (meaning inverted) defaults to working in recent coreutils when cross-compiling for linux
* gl_cv_func_rename_trailing_slash_bug -> gl_cv_func_rename_slash_src_works (meaning inverted) defaults to working in recent coreutils when cross-compiling for linux

This helps to make some tools work in the first place (uptime), but also avoids useless extra wrappers which coreutils otherwise compiles in.

While at it, convert to CACHED_CONFIGUREVAR instead of EXTRA_OECONF.

---
 recipes-core/coreutils/coreutils_6.9.bb | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
recipes-core/coreutils/coreutils_6.9.bb +7 -1
index f6017ec..42b4f3c 100644
@@ -32,9 +32,15 @@ SRC_URI = "${GNU_MIRROR}/coreutils/${BP}.tar.bz2 \
 SRC_URI[md5sum] = "c9607d8495f16e98906e7ed2d9751a06"
 SRC_URI[sha256sum] = "89c2895ad157de50e53298b22d91db116ee4e1dd3fdf4019260254e2e31497b0"
 
-EXTRA_OECONF += "ac_cv_func_getgroups_works=yes \
+CACHED_CONFIGUREVARS = "ac_cv_func_getgroups_works=yes \
                  ac_cv_func_strcoll_works=yes \
                  ac_cv_func_working_mktime=yes \
+                 jm_ac_cv_func_link_follows_symlink=no \
+                 jm_cv_func_unlink_busy_text=yes \
+                 jm_cv_have_proc_uptime=yes \
+                 gl_cv_func_mkdir_trailing_slash_bug=no \
+                 gl_cv_func_rename_trailing_slash_bug=no \
+                 gl_cv_func_rename_trailing_dest_slash_bug=no \
                  "
 
 # acl is not a default feature
Signature · 1 line
2.23.0.rc1

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw

Re: [yocto][meta-gplv2][PATCH 2/2] coreutils: set some more autotools / m4 test results

ping

Quoted 52 lines · Andr? Draszik

From: André Draszik <[email protected]>

While we set test outcomes in oe-core meta/site, this here uses an old version of gnulib with slightly different variable names for some of the results:

* jm_cv_func_unlink_busy_text -> gl_cv_func_unlink_busy_text
* jm_cv_have_proc_uptime -> gl_cv_have_proc_uptime
* jm_ac_cv_func_link_follows_symlink -> gl_cv_func_link_follows_symlink
* gl_cv_func_mkdir_trailing_slash_bug -> gl_cv_func_mkdir_trailing_slash_works (meaning inverted) (defaults to working in recent coreutils when cross-compiling
* gl_cv_func_rename_trailing_dest_slash_bug -> gl_cv_func_rename_slash_dst_works (meaning inverted) defaults to working in recent coreutils when cross-compiling for linux
* gl_cv_func_rename_trailing_slash_bug -> gl_cv_func_rename_slash_src_works (meaning inverted) defaults to working in recent coreutils when cross-compiling for linux

This helps to make some tools work in the first place (uptime), but also avoids useless extra wrappers which coreutils otherwise compiles in.

While at it, convert to CACHED_CONFIGUREVAR instead of EXTRA_OECONF.

---
 recipes-core/coreutils/coreutils_6.9.bb | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
recipes-core/coreutils/coreutils_6.9.bb +7 -1
index f6017ec..42b4f3c 100644
@@ -32,9 +32,15 @@ SRC_URI = "${GNU_MIRROR}/coreutils/${BP}.tar.bz2 \
 SRC_URI[md5sum] = "c9607d8495f16e98906e7ed2d9751a06"
 SRC_URI[sha256sum] = "89c2895ad157de50e53298b22d91db116ee4e1dd3fdf4019260254e2e31497b0"
 
-EXTRA_OECONF += "ac_cv_func_getgroups_works=yes \
+CACHED_CONFIGUREVARS = "ac_cv_func_getgroups_works=yes \
                  ac_cv_func_strcoll_works=yes \
                  ac_cv_func_working_mktime=yes \
+                 jm_ac_cv_func_link_follows_symlink=no \
+                 jm_cv_func_unlink_busy_text=yes \
+                 jm_cv_have_proc_uptime=yes \
+                 gl_cv_func_mkdir_trailing_slash_bug=no \
+                 gl_cv_func_rename_trailing_slash_bug=no \
+                 gl_cv_func_rename_trailing_dest_slash_bug=no \
                  "
 
 # acl is not a default feature

A message that is not in the archive (sent off-list or not yet received): [email protected]

#5 lore raw

Re: [yocto][meta-gplv2][PATCH 2/2] coreutils: set some more autotools / m4 test results

ping

Quoted 57 lines · André Draszik

ping

Quoted 52 lines · Andr? Draszik

From: André Draszik <[email protected]>

While we set test outcomes in oe-core meta/site, this here uses an old version of gnulib with slightly different variable names for some of the results:

* jm_cv_func_unlink_busy_text -> gl_cv_func_unlink_busy_text
* jm_cv_have_proc_uptime -> gl_cv_have_proc_uptime
* jm_ac_cv_func_link_follows_symlink -> gl_cv_func_link_follows_symlink
* gl_cv_func_mkdir_trailing_slash_bug -> gl_cv_func_mkdir_trailing_slash_works (meaning inverted) (defaults to working in recent coreutils when cross-compiling
* gl_cv_func_rename_trailing_dest_slash_bug -> gl_cv_func_rename_slash_dst_works (meaning inverted) defaults to working in recent coreutils when cross-compiling for linux
* gl_cv_func_rename_trailing_slash_bug -> gl_cv_func_rename_slash_src_works (meaning inverted) defaults to working in recent coreutils when cross-compiling for linux

This helps to make some tools work in the first place (uptime), but also avoids useless extra wrappers which coreutils otherwise compiles in.

While at it, convert to CACHED_CONFIGUREVAR instead of EXTRA_OECONF.

---
 recipes-core/coreutils/coreutils_6.9.bb | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
recipes-core/coreutils/coreutils_6.9.bb +7 -1
index f6017ec..42b4f3c 100644
@@ -32,9 +32,15 @@ SRC_URI = "${GNU_MIRROR}/coreutils/${BP}.tar.bz2 \
 SRC_URI[md5sum] = "c9607d8495f16e98906e7ed2d9751a06"
 SRC_URI[sha256sum] = "89c2895ad157de50e53298b22d91db116ee4e1dd3fdf4019260254e2e31497b0"
 
-EXTRA_OECONF += "ac_cv_func_getgroups_works=yes \
+CACHED_CONFIGUREVARS = "ac_cv_func_getgroups_works=yes \
                  ac_cv_func_strcoll_works=yes \
                  ac_cv_func_working_mktime=yes \
+                 jm_ac_cv_func_link_follows_symlink=no \
+                 jm_cv_func_unlink_busy_text=yes \
+                 jm_cv_have_proc_uptime=yes \
+                 gl_cv_func_mkdir_trailing_slash_bug=no \
+                 gl_cv_func_rename_trailing_slash_bug=no \
+                 gl_cv_func_rename_trailing_dest_slash_bug=no \
                  "
 
 # acl is not a default feature