Skip to content

Musl build#3114

Open
MichaelRabek wants to merge 7 commits intolinux-nvme:masterfrom
MichaelRabek:musl-build
Open

Musl build#3114
MichaelRabek wants to merge 7 commits intolinux-nvme:masterfrom
MichaelRabek:musl-build

Conversation

@MichaelRabek
Copy link

@MichaelRabek MichaelRabek commented Feb 26, 2026

This series of patches contributes to solving the recurring problem with build fails with musl libc. It includes proposed build configuration and a new CI build job.

Things to check before removing draft status:

  • Do all tests pass with the musl build?
  • Is there a CI build job using an Alpine-based container image?

@MichaelRabek MichaelRabek force-pushed the musl-build branch 2 times, most recently from 2a1b960 to 4ab15fe Compare February 27, 2026 22:48
@igaw
Copy link
Collaborator

igaw commented Mar 2, 2026

Looks almost ready. There are some checkpatch complains for the last patch. Rest looks good!

I would ignore the checkpatch error for the nvme_basename function. This is a bit silly as it is a clear copy from glibc. Let's keep it this way.

@MichaelRabek
Copy link
Author

Looks almost ready. There are some checkpatch complains for the last patch. Rest looks good!

I would ignore the checkpatch error for the nvme_basename function. This is a bit silly as it is a clear copy from glibc. Let's keep it this way.

Glad to hear that! Please don't merge this yet though. I'd like to make one more patch with the Alpine build.

@igaw
Copy link
Collaborator

igaw commented Mar 2, 2026

I'll wait until you mark it ready for review before I attempt to merge it.

POSIX states that basename(3) may modify its input string. For this
reason, strdup(3) is used in__nvme_transport_handle_open_direct() so
that it is safe to call basename(3) on a const char*.

This patch introduces an nvme_basename() function that is guaranteed to
never modify its input and is thus safe to be used on string literals.
It is a copy of basename(3) implementation from glibc.

This change allows us to avoid one needless dynamic allocation.

Signed-off-by: Michal Rábek <mrabek@redhat.com>
Signed-off-by: Michal Rábek <mrabek@redhat.com>
Signed-off-by: Michal Rábek <mrabek@redhat.com>
Builds with musl libc get broken too often. This patch suggests a new
GitHub CI build job to help maintain them being functional.

Closes: linux-nvme#2565
Link: linux-nvme#2565
Signed-off-by: Michal Rábek <mrabek@redhat.com>
The 'nvme-cli - uint128' test was failing when build with musl libc.
The reason was that musl libc leaves the thousands separator from
LC_NUMERIC empty with the fr_FR.utf-8.

This patch offers a solution by skipping the test with a warning
if the thousands separator cannot be obtained.

Signed-off-by: Michal Rábek <mrabek@redhat.com>
The long '--unified' flag of the 'diff' command is GNU specific.
Although it is recognized by the Alpine Linux version of 'diff', it is
expecting a numeric argument N (number of lines).

This difference caused test cases using 'diff' to fail on Alpine.

This patch changes that to '-u' which implies N=3 by default on both
GNU-based distros and Alpine Linux.

Signed-off-by: Michal Rábek <mrabek@redhat.com>
This patch introduces a new CI job that builds the project with musl
standard C library in the environment in which it is most commonly used
- Alpine Linux.

Signed-off-by: Michal Rábek <mrabek@redhat.com>
@MichaelRabek MichaelRabek marked this pull request as ready for review March 6, 2026 09:20
@MichaelRabek MichaelRabek requested a review from igaw March 6, 2026 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants