Bug 2142273 - lvm2-2.03.14: daemons/lvmpolld/lvmpolld-core.c: strerror_r on musl libc always returns int
Summary: lvm2-2.03.14: daemons/lvmpolld/lvmpolld-core.c: strerror_r on musl libc alway...
Keywords:
Status: POST
Alias: None
Product: LVM and device-mapper
Classification: Community
Component: lvm2
Version: unspecified
Hardware: Unspecified
OS: Linux
unspecified
high
Target Milestone: ---
: ---
Assignee: Zdenek Kabelac
QA Contact: cluster-qe
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-11-12 14:08 UTC by v
Modified: 2023-08-10 15:40 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Embargoed:
pm-rhel: lvm-technical-solution?
pm-rhel: lvm-test-coverage?


Attachments (Terms of Use)

Description v 2022-11-12 14:08:33 UTC
Description of problem:
On musl libc *strerror_r* defined to return int even with _GNU_SOURCE:
```
/* /usr/include/string.h */
#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
 || defined(_BSD_SOURCE)
// ...
int strerror_r (int, char *, size_t);
// ...
```

this causes compilation error:
```
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 */
```

Version-Release number of selected component (if applicable):
2.03.14

How reproducible:
Always

Steps to Reproduce:
Try to build on musl libc


Expected results:
Successful build

Comment 1 Zdenek Kabelac 2022-11-14 10:58:37 UTC
Hmmm - seems like testing condition for _GNU_SOURCE could be improved and checked better if the system actually provides symbol in right variant.

It's worth to note lvm2 project is only supported for  glibc  - that fact it mostly works with i.e. 'musl C library' is mostly due to support from users using it - i.e. we can apply patches - however we do not have any system with such library present.

Comment 2 Zdenek Kabelac 2022-11-30 15:49:24 UTC
Upstream patch: https://listman.redhat.com/archives/lvm-devel/2022-November/024479.html


Note You need to log in before you can comment on or make changes to this bug.