Summary: | sys-fs/lvm2-2.03.14-r3: fails to build with clang (lvmpolld-core.c:56:9: error: incompatible integer to pointer conversion returning 'int' from a function with result type 'const char *') | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | gresskar1 |
Component: | Current packages | Assignee: | Gentoo's Team for Core System packages <base-system> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | agk, danterobinson2000, robbat2, sam |
Priority: | Normal | Keywords: | PATCH |
Version: | unspecified | ||
Hardware: | AMD64 | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | |||
Bug Blocks: | 408963, 870412 | ||
Attachments: |
emerge --info / emerge -pqv / build.log
strerror_r-lvmpolld-core.patch |
In future, please attach the build.log as an attachment, and paste emerge --info in the first comment (or a separate attachment if you wish). *** Bug 881659 has been marked as a duplicate of this bug. *** It's assuming the GNU variant of strerror_r: https://www.openwall.com/lists/musl/2018/08/05/2. I think they try to do the right thing but I'm not sure it works properly: ``` static const char *_strerror_r(int errnum, struct lvmpolld_thread_data *data) { #ifdef _GNU_SOURCE return strerror_r(errnum, data->buf, sizeof(data->buf)); /* never returns NULL */ #elif (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) return strerror_r(errnum, data->buf, sizeof(data->buf)) ? "" : data->buf; #else # warning "Can't decide proper strerror_r implementation. lvmpolld will not issue specific system error messages" return ""; #endif } ``` _GNU_SOURCE being set does not guarantee that libc provides the interface it wants. It does on glibc, but not on musl. configure.ac actually has AC_FUNC_STRERROR_R which does what they want! From the autoconf manual: """ — Macro: AC_FUNC_STRERROR_R If strerror_r is available, define HAVE_STRERROR_R, and if it is declared, define HAVE_DECL_STRERROR_R. If it returns a char * message, define STRERROR_R_CHAR_P; otherwise it returns an int error number. The Thread-Safe Functions option of Posix requires strerror_r to return int, but many systems (including, for example, version 2.2.4 of the GNU C Library) return a char * value that is not necessarily equal to the buffer argument. The result of this macro is cached in the ac_cv_func_strerror_r_char_p variable. """ Created attachment 833269 [details, diff]
strerror_r-lvmpolld-core.patch
Can someone try the patch I've attached? Thanks. (In reply to Sam James from comment #5) > Created attachment 833269 [details, diff] [details, diff] > strerror_r-lvmpolld-core.patch Tested, works for me. The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=39e348fad976c54d3980c2149de6365e8d035a4d commit 39e348fad976c54d3980c2149de6365e8d035a4d Author: Sam James <sam@gentoo.org> AuthorDate: 2022-11-18 17:59:02 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2022-11-18 17:59:02 +0000 sys-fs/lvm2: fix strerror_r check for musl Closes: https://bugs.gentoo.org/869404 Signed-off-by: Sam James <sam@gentoo.org> .../lvm2/files/lvm2-2.03.16-musl-strerror_r.patch | 23 ++++++++++++++++++++++ sys-fs/lvm2/lvm2-2.03.16-r2.ebuild | 1 + 2 files changed, 24 insertions(+) |
Created attachment 804328 [details] emerge --info / emerge -pqv / build.log sys-fs/lvm2-2.03.14-r3: fails to build with clang: lvmpolld-core.c:56:9: error: incompatible integer to pointer conversion returning 'int' from a function with result type 'const char *' [-Wint-conversion] return strerror_r(errnum, data->buf, sizeof(data->buf)); /* never returns NULL */