More build fixes
cover More build fixes
Another batch of fixes for compiling on Alpine Linux and/or clang:
https://github.com/mesonbuild/wrapdb/pull/2646
Bastien Nocera (4):
unit: Fix incorrect basename usage
ell: Fix rawmemchr implementation warning in Alpine/clang
ell: Fix cert_pkcs12_pbkdf() warning under Alpine/clang
unit: Skip hwdb test when hwdb isn't available
ell/cert-crypto.c | 4 ++++ ell/missing.h | 4 ++++ unit/test-hwdb.c | 13 ++++++++++--- unit/test-path.c | 4 ++-- 4 files changed, 20 insertions(+), 5 deletions(-)
Signature · 1 line
2.53.0
PATCH 1/4 unit: Fix incorrect basename usage
The code called basename(), which requires either relying on the GNU libc, or including libgen.h to get access to the POSIX implementation.
As neither was done, and the output of basename() was not freed, it's likely that the intent was to use the library-exported l_basename() instead which does not output an allocated string.
ninja: job failed: clang -Isubprojects/ell-0.83/unit/test-path.p -Isubprojects/ell-0.83/unit -I../subprojects/ell-0.83/unit -Isubprojects/ell-0.83 -I../subprojects/ell-0.83 -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -O0 -g -DHAVE_CONFIG_H '-DUNITDIR="/home/runner/work/wrapdb/wrapdb/subprojects/ell-0.83/unit/"' '-DCERTDIR="/home/runner/work/wrapdb/wrapdb/_build/subprojects/ell-0.83/unit/"' -MD -MQ subprojects/ell-0.83/unit/test-path.p/test-path.c.o -MF subprojects/ell-0.83/unit/test-path.p/test-path.c.o.d -o subprojects/ell-0.83/unit/test-path.p/test-path.c.o -c ../subprojects/ell-0.83/unit/test-path.c ../subprojects/ell-0.83/unit/test-path.c:65:9: error: call to undeclared function 'basename'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
65 | base = basename(tmp_path);
| ^../subprojects/ell-0.83/unit/test-path.c:65:9: note: did you mean 'l_basename'?../subprojects/ell-0.83/ell/path.h:20:13: note: 'l_basename' declared here
20 | const char *l_basename(const char *path);
| ^../subprojects/ell-0.83/unit/test-path.c:65:7: error: incompatible integer to pointer conversion assigning to 'char *' from 'int' [-Wint-conversion]
65 | base = basename(tmp_path);
| ^ ~~~~~~~~~~~~~~~~~~
---
unit/test-path.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)unit/test-path.c +2 -2
@@ -55,14 +55,14 @@ static void test_path_find(const void *data)static const char *cant_find ="/foo:/bar:/dir:fr" ;static const char *can_find ="/tmp" ;char *tmp_path =l_strdup ("/tmp/foobarXXXXXX.tmp" ); -char *base; +const char *base;char *path;int fd; fd =L_TFR (mkostemps (tmp_path,4 ,O_CLOEXEC ));assert (fd >0 );L_TFR (close (fd)); - base =basename (tmp_path); + base =l_basename (tmp_path);assert (l_path_find (base, cant_find,F_OK ) ==NULL );
Signature · 1 line
2.53.0
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH 1/4] unit: Fix incorrect basename usage
Quoted 7 lines · Phil Hodges
found
cant_findmeaning can't find expectedcannot_findAn English teacher taught me to expand the apostrophe in written English,
long before we ever wanted to use apostrophe in an identifier."cant" looks ignorant and wrong.
I'm having a hard time figuring out how this is relevant as I'm not touching any lines of code that mention "cant_find", that you didn't put the mailing-list in copy where folks that might have written this code might read it, and that your idea of what is a proper identifier is probably antiquated.
"ignorant and wrong" alright.
Quoted 64 lines · Bastien Nocera
The code called
basename(), which requires either relying on the GNU libc, or includinglibgen.hto get access to the POSIX implementation.As neither was done, and the output of
basename()was not freed, it's likely that the intent was to use the library-exportedl_basename()instead which does not output an allocated string.ninja: job failed: clang -Isubprojects/ell-0.83/unit/test-path.p - Isubprojects/ell-0.83/unit -I../subprojects/ell-0.83/unit - Isubprojects/ell-0.83 -I../subprojects/ell-0.83 -fdiagnostics- color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -O0 -g -
DHAVE_CONFIG_H'- DUNITDIR="/home/runner/work/wrapdb/wrapdb/subprojects/ell- 0.83/unit/"' '- DCERTDIR="/home/runner/work/wrapdb/wrapdb/_build/subprojects/ell- 0.83/unit/"' -MD -MQ subprojects/ell-0.83/unit/test-path.p/test- path.c.o -MF subprojects/ell-0.83/unit/test-path.p/test-path.c.o.d -osubprojects/ell-0.83/unit/test-path.p/test-path.c.o-c../subprojects/ell-0.83/unit/test-path.c../subprojects/ell-0.83/unit/test-path.c:65:9: error: call to undeclared function 'basename'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 65 | base =basename(tmp_path);
| ^../subprojects/ell-0.83/unit/test-path.c:65:9: note: did you mean 'l_basename'?../subprojects/ell-0.83/ell/path.h:20:13: note: 'l_basename' declared here
20 | const char *l_basename(const char *path);
| ^../subprojects/ell-0.83/unit/test-path.c:65:7: error: incompatible integer to pointer conversion assigning to 'char *' from 'int' [- Wint-conversion]
65 | base =basename(tmp_path);
| ^ ~~~~~~~~~~~~~~~~~~
---unit/test-path.c| 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)unit/test-path.c +2
-2@@ -55,14 +55,14 @@ static void test_path_find(const void *data)static const char *cant_find ="/foo:/bar:/dir:fr" ;static const char *can_find ="/tmp" ;char *tmp_path =l_strdup ("/tmp/foobarXXXXXX.tmp" ); -char *base; +const char *base;char *path;int fd; fd =L_TFR (mkostemps (tmp_path,4 ,O_CLOEXEC ));assert (fd >0 );L_TFR (close (fd)); - base =basename (tmp_path); + base =l_basename (tmp_path);assert (l_path_find (base, cant_find,F_OK ) ==NULL );
PATCH 2/4 ell: Fix rawmemchr implementation warning in Alpine/clang
In reply to Bastien Nocerarawmemchr() is not available under Alpine, it's a glibc function, which means our local implementation is used. That implementation tried to disable GCC specific warnings which aren't available under clang, so disable the pragma statements to disable the warnings when run under clang.
In file included from ../ell/random.c:20:../ell/missing.h:61:1: warning: unknown warning group '-Wstringop-overflow=', ignored [-Wunknown-warning-option]
61 | _Pragma("GCC diagnostic ignored \"-Wstringop-overflow=\"")
| ^
<scratch space>:20:25: note: expanded from here
20 | GCC diagnostic ignored "-Wstringop-overflow="
| ^
1 warning generated.
[repeated many times]
--- ell/missing.h | 4 ++++ 1 file changed, 4 insertions(+)
ell/missing.h +4 -0
@@ -56,9 +56,13 @@ static inline void explicit_bzero(void *s, size_t n)#ifndef HAVE_RAWMEMCHR static inline void *rawmemchr (const void *s,int c) { +#if defined(__GNUC__) && !defined(__clang__) _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wstringop-overflow=\"") +#endif /* gcc && !clang */ return memchr (s, c,PTRDIFF_MAX ); +#if defined(__GNUC__) && !defined(__clang__) _Pragma("GCC diagnostic pop") +#endif /* gcc && !clang */ }#endif
Signature · 1 line
2.53.0
PATCH 3/4 ell: Fix cert_pkcs12_pbkdf() warning under Alpine/clang
In reply to Bastien NoceraDisable GCC specific warning under clang.
../ell/cert-crypto.c:235:1: warning: unknown warning group '-Wmaybe-uninitialized', ignored [-Wunknown-warning-option]
235 | _Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
| ^
<scratch space>:28:25: note: expanded from here
28 | GCC diagnostic ignored "-Wmaybe-uninitialized"
| ^
1 warning generated.../ell/cert-crypto.c:235:1: warning: unknown warning group '-Wmaybe-uninitialized', ignored [-Wunknown-warning-option]
235 | _Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
| ^
<scratch space>:28:25: note: expanded from here
28 | GCC diagnostic ignored "-Wmaybe-uninitialized"
| ^
1 warning generated.
--- ell/cert-crypto.c | 4 ++++ 1 file changed, 4 insertions(+)
ell/cert-crypto.c +4 -0
@@ -231,8 +231,10 @@ uint8_t *cert_pkcs12_pbkdf(const char *password, ptr += s_len + salt_len - j; } +#if defined(__GNUC__) && !defined(__clang__) _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +#endif /* gcc && !clang */ if (p_len) {for (j = passwd_len; j < p_len; j += passwd_len, ptr += passwd_len)
@@ -243,7 +245,9 @@ _Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")explicit_bzero (bmpstring, passwd_len);l_free (bmpstring); } +#if defined(__GNUC__) && !defined(__clang__) _Pragma("GCC diagnostic pop") +#endif /* gcc && !clang */ key =l_malloc (key_len + hash->len);
Signature · 1 line
2.53.0
PATCH 4/4 unit: Skip hwdb test when hwdb isn't available
In reply to Bastien NoceraAlpine includes a compatible libudev without implementing hwdb, so skip the test on that platform.
--- unit/test-hwdb.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
unit/test-hwdb.c +10 -3
@@ -14,6 +14,8 @@#include <ell/ell.h> +static struct l_hwdb *hwdb =NULL ; +struct hwdb_stats {int aliases;int entries;
@@ -56,11 +58,9 @@ static void check_entry(const char *modalias, struct l_hwdb_entry *entries,static void test_hwdb (const void *data) { -struct l_hwdb *hwdb;struct hwdb_stats stats = {0 };bool result; - hwdb =l_hwdb_new_default ();assert (hwdb); result =l_hwdb_foreach (hwdb, check_entry, &stats);
@@ -84,11 +84,18 @@ static void test_hwdb(const void *data)l_hwdb_unref (hwdb); } +static bool test_hwdb_precheck (const void *data) +{ + hwdb =l_hwdb_new_default (); +return hwdb !=NULL ; +} +int main (int argc,char *argv[]) {l_test_init (&argc, &argv); -l_test_add ("hwdb" , test_hwdb,NULL ); +l_test_add_func_precheck ("hwdb" , + test_hwdb, test_hwdb_precheck,0 );return l_test_run (); }
Signature · 1 line
2.53.0
Hey,
Would it be possible to get a review on those?
Cheers
Quoted 14 lines · Bastien Nocera
Another batch of fixes for compiling on Alpine Linux and/or clang:
https://github.com/mesonbuild/wrapdb/pull/2646Bastien Nocera (4):
unit: Fix incorrect basename usage
ell: Fix rawmemchr implementation warning in Alpine/clang
ell: Fixcert_pkcs12_pbkdf()warning under Alpine/clang
unit: Skip hwdb test when hwdb isn't availableell/cert-crypto.c | 4 ++++
ell/missing.h | 4 ++++
unit/test-hwdb.c | 13 ++++++++++---
unit/test-path.c | 4 ++--4 files changed, 20 insertions(+), 5 deletions(-)
Hello again,
Would it be possible to get those merged?
Regards
Quoted 21 lines · Bastien Nocera
Hey,
Would it be possible to get a review on those?
Cheers
Quoted 14 lines · Bastien Nocera
Another batch of fixes for compiling on Alpine Linux and/or clang:
https://github.com/mesonbuild/wrapdb/pull/2646Bastien Nocera (4):
unit: Fix incorrect basename usage
ell: Fix rawmemchr implementation warning in Alpine/clang
ell: Fixcert_pkcs12_pbkdf()warning under Alpine/clang
unit: Skip hwdb test when hwdb isn't availableell/cert-crypto.c | 4 ++++
ell/missing.h | 4 ++++
unit/test-hwdb.c | 13 ++++++++++---
unit/test-path.c | 4 ++--4 files changed, 20 insertions(+), 5 deletions(-)
Hello again,
Those patches were sent back in March, and I've pinged about getting them reviewed back in April and June, to no avail.
Could you please let me know what's missing to get those build patches reviewed and merged?
Regards
Quoted 29 lines · Bastien Nocera
Hello again,
Would it be possible to get those merged?
Regards
Quoted 22 lines · Bastien Nocera
Hey,
Would it be possible to get a review on those?
Cheers
Quoted 15 lines · Bastien Nocera
Another batch of fixes for compiling on Alpine Linux and/or clang:
https://github.com/mesonbuild/wrapdb/pull/2646Bastien Nocera (4):
unit: Fix incorrect basename usage
ell: Fix rawmemchr implementation warning in Alpine/clang
ell: Fixcert_pkcs12_pbkdf()warning under Alpine/clang
unit: Skip hwdb test when hwdb isn't availableell/cert-crypto.c | 4 ++++
ell/missing.h | 4 ++++
unit/test-hwdb.c | 13 ++++++++++---
unit/test-path.c | 4 ++--4 files changed, 20 insertions(+), 5 deletions(-)