Hi

OATH Toolkit doesn't use or need strerror_l anywehere.  I got this
complaint on macOS for OATH Toolkit [1]:

libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../../../liboath/gl -I.. 
-fvisibility=hidden -Wno-cast-qual -Wno-conversion -Wno-float-equal 
-Wno-sign-compare -Wno-undef -Wno-unused-function -Wno-unused-parameter 
-Wno-float-conversion -Wimplicit-fallthrough -Wno-pedantic 
-Wno-tautological-constant-out-of-range-compare -Wno-sign-conversion 
-Wno-type-limits -Wno-unused-const-variable -Wno-error -g -O2 -MT 
libgnu_la-byteswap.lo -MD -MP -MF .deps/libgnu_la-byteswap.Tpo -c 
../../../liboath/gl/byteswap.c -o libgnu_la-byteswap.o >/dev/null 2>&1
In file included from ../../../liboath/gl/basename-lgpl.c:24:
./string.h:2040:18: error: use of undeclared identifier 'strerror_l'; did you 
mean 'strerror_r'?
 2040 | _GL_WARN_ON_USE (strerror_l, "strerror_l is unportable - "
      |                  ^

And on Windows MINGW64 [2]:

make[5]: Entering directory 
'/c/GitLab-Runner/builds/oath-toolkit/oath-toolkit/oath-toolkit-2.6.12.62-d61b/liboath/gtk-doc'
In file included from oath.h:58,
                 from hotp.c:23:
./gl/string.h:2040:1: error: 'strerror_l' undeclared here (not in a function); 
did you mean 'strerror_s'?
 2040 | _GL_WARN_ON_USE (strerror_l, "strerror_l is unportable - "
      | ^~~~~~~~~~~~~~~
make[3]: *** [Makefile:1645: hotp.lo] Error 1

Judging from the errors, is this a gnulib problem, or a consequence of
how I'm using gnulib in OATH Toolkit?

Reading string.in.h and comparing with other declarations, I came up
with the patch below that fixes my problem (confirmed) but I'm fairly
sure I don't understand how the logic here is intended to work.

Any hints?

/Simon

[1] https://gitlab.com/oath-toolkit/oath-toolkit/-/jobs/9649709478
[2] https://gitlab.com/oath-toolkit/oath-toolkit/-/jobs/9649709430

diff --git a/lib/string.in.h b/lib/string.in.h
index e6bf675151..44b9497d80 100644
--- a/lib/string.in.h
+++ b/lib/string.in.h
@@ -1499,9 +1499,10 @@ _GL_CXXALIASWARN (strerror_l);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strerror_l
-/* Assume strerror_l is always declared.  */
+# if HAVE_RAW_DECL_STRERROR_L
 _GL_WARN_ON_USE (strerror_l, "strerror_l is unportable - "
                  "use gnulib module strerror_l for portability");
+# endif
 #endif
 
 /* Map any int, typically from errno, into an error message.  Multithread-safe,

Attachment: signature.asc
Description: PGP signature

Reply via email to