From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-apps/nvme-cli/, sys-apps/nvme-cli/files/
Date: Sat, 4 May 2024 12:43:54 +0000 (UTC) [thread overview]
Message-ID: <1714826510.77cafa5b9680f82d40cadd79559f7b642cb8cdf7.sam@gentoo> (raw)
commit: 77cafa5b9680f82d40cadd79559f7b642cb8cdf7
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat May 4 12:41:50 2024 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat May 4 12:41:50 2024 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=77cafa5b
sys-apps/nvme-cli: fix musl build
Closes: https://bugs.gentoo.org/931194
Signed-off-by: Sam James <sam <AT> gentoo.org>
.../files/nvme-cli-2.9.1-musl-stdint.patch | 107 +++++++++++++++++++++
sys-apps/nvme-cli/nvme-cli-2.9.1.ebuild | 4 +
2 files changed, 111 insertions(+)
diff --git a/sys-apps/nvme-cli/files/nvme-cli-2.9.1-musl-stdint.patch b/sys-apps/nvme-cli/files/nvme-cli-2.9.1-musl-stdint.patch
new file mode 100644
index 000000000000..6ecdac41e3cc
--- /dev/null
+++ b/sys-apps/nvme-cli/files/nvme-cli-2.9.1-musl-stdint.patch
@@ -0,0 +1,107 @@
+https://github.com/linux-nvme/nvme-cli/pull/2332
+
+From 61bbd959bc069e4552e50a276b8a0e1487545ec2 Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Sat, 4 May 2024 09:13:06 +0100
+Subject: [PATCH 1/2] Use C99 types for uint32_t
+
+<stdint.h> provides `uint32_t`, while `u_int_32` is an unofficial/internal
+typedef that glibc happens to provide. This fixes the build on musl.
+
+Bug: https://bugs.gentoo.org/931194
+Signed-off-by: Sam James <sam@gentoo.org>
+--- a/nvme.c
++++ b/nvme.c
+@@ -34,6 +34,7 @@
+ #include <inttypes.h>
+ #include <locale.h>
+ #include <stdio.h>
++#include <stdint.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <unistd.h>
+@@ -9075,8 +9076,8 @@ static int check_dhchap_key(int argc, char **argv, struct command *command, stru
+
+ unsigned char decoded_key[128];
+ unsigned int decoded_len;
+- u_int32_t crc = crc32(0L, NULL, 0);
+- u_int32_t key_crc;
++ uint32_t crc = crc32(0L, NULL, 0);
++ uint32_t key_crc;
+ int err = 0, hmac;
+ struct config {
+ char *key;
+@@ -9144,10 +9145,10 @@ static int check_dhchap_key(int argc, char **argv, struct command *command, stru
+ return -EINVAL;
+ }
+ crc = crc32(crc, decoded_key, decoded_len);
+- key_crc = ((u_int32_t)decoded_key[decoded_len]) |
+- ((u_int32_t)decoded_key[decoded_len + 1] << 8) |
+- ((u_int32_t)decoded_key[decoded_len + 2] << 16) |
+- ((u_int32_t)decoded_key[decoded_len + 3] << 24);
++ key_crc = ((uint32_t)decoded_key[decoded_len]) |
++ ((uint32_t)decoded_key[decoded_len + 1] << 8) |
++ ((uint32_t)decoded_key[decoded_len + 2] << 16) |
++ ((uint32_t)decoded_key[decoded_len + 3] << 24);
+ if (key_crc != crc) {
+ nvme_show_error("CRC mismatch (key %08x, crc %08x)", key_crc, crc);
+ return -EINVAL;
+--- a/util/base64.c
++++ b/util/base64.c
+@@ -20,6 +20,7 @@
+ * MA 02110-1301, USA.
+ */
+
++#include <stdint.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <errno.h>
+@@ -42,7 +43,7 @@ static const char base64_table[65] =
+ int base64_encode(const unsigned char *src, int srclen, char *dst)
+ {
+ int i, bits = 0;
+- u_int32_t ac = 0;
++ uint32_t ac = 0;
+ char *cp = dst;
+
+ for (i = 0; i < srclen; i++) {
+@@ -77,7 +78,7 @@ int base64_encode(const unsigned char *src, int srclen, char *dst)
+ */
+ int base64_decode(const char *src, int srclen, unsigned char *dst)
+ {
+- u_int32_t ac = 0;
++ uint32_t ac = 0;
+ int i, bits = 0;
+ unsigned char *bp = dst;
+
+
+From 51208e30da0bfb12340d3a4f3afa0472312a8541 Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Sat, 4 May 2024 09:15:03 +0100
+Subject: [PATCH 2/2] `u_char` -> `unsigned char`
+
+`u_char` is not a standard name for `unsigned char` and may not work;
+some implementations may provide it for convenience.
+
+Signed-off-by: Sam James <sam@gentoo.org>
+--- a/plugins/innogrit/typedef.h
++++ b/plugins/innogrit/typedef.h
+@@ -53,14 +53,14 @@ struct vsc_smart_log {
+ unsigned int low_pwr_cnt;
+ unsigned int wa;
+ unsigned int ps3_entry_cnt;
+- u_char highest_temp[4];
++ unsigned char highest_temp[4];
+ unsigned int weight_ec;
+ unsigned int slc_cap_mb;
+ unsigned long long nand_page_write_cnt;
+ unsigned int program_error_cnt;
+ unsigned int erase_error_cnt;
+- u_char flash_type;
+- u_char reserved2[3];
++ unsigned char flash_type;
++ unsigned char reserved2[3];
+ unsigned int hs_crc_err_cnt;
+ unsigned int ddr_ecc_err_cnt;
+ unsigned int reserved3[44];
+
diff --git a/sys-apps/nvme-cli/nvme-cli-2.9.1.ebuild b/sys-apps/nvme-cli/nvme-cli-2.9.1.ebuild
index ec7eb940d65c..ead3edbdb1f6 100644
--- a/sys-apps/nvme-cli/nvme-cli-2.9.1.ebuild
+++ b/sys-apps/nvme-cli/nvme-cli-2.9.1.ebuild
@@ -27,6 +27,10 @@ BDEPEND="
virtual/pkgconfig
"
+PATCHES=(
+ "${FILESDIR}"/${PN}-2.9.1-musl-stdint.patch
+)
+
src_configure() {
local emesonargs=(
-Dversion-tag="${PV}"
next reply other threads:[~2024-05-04 12:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-04 12:43 Sam James [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-02-06 3:05 [gentoo-commits] repo/gentoo:master commit in: sys-apps/nvme-cli/, sys-apps/nvme-cli/files/ Sam James
2023-12-28 4:04 Sam James
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1714826510.77cafa5b9680f82d40cadd79559f7b642cb8cdf7.sam@gentoo \
--to=sam@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox