Skip to contentSkip to conversation

tools/hex2hcd: fix musl compatibility

PATCH In review Rahul Sandhu 2 participants 2 messages Jul 10, 2024 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/hex2hcd: fix musl compatibility

The call to basename() relies on a GNU extension
to take a const char * vs a char *. Let's define
a trivial helper function to ensure compatibility
with musl.

Downstream gentoo bug: https://bugs.gentoo.org/926344
Fixes: #843

---
 tools/hex2hcd.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
tools/hex2hcd.c +6 -1
index e6dca5a81..42c95b759 100644
@@ -285,6 +285,11 @@ static void ver_parse_file(const char *pathname)
 	prev->next = ver;
 }
 
+static const char *helper_basename(const char *path) {
+  const char *base = strrchr(path, '/');
+  return base ? base + 1 : path;
+}
+
 static void ver_parse_entry(const char *pathname)
 {
 	struct stat st;
@@ -302,7 +307,7 @@ static void ver_parse_entry(const char *pathname)
 	}
 
 	if (S_ISREG(st.st_mode)) {
-		ver_parse_file(basename(pathname));
+		ver_parse_file(helper_basename(pathname));
 		goto done;
 	}
 
Signature · 1 line
2.45.2
#1 lore raw

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=870104

---Test result---

Test Summary:

CheckPatch                    FAIL      0.71 seconds
GitLint                       PASS      0.87 seconds
BuildEll                      PASS      24.82 seconds
BluezMake                     PASS      1589.95 seconds
MakeCheck                     PASS      13.30 seconds
MakeDistcheck                 PASS      178.09 seconds
CheckValgrind                 PASS      254.21 seconds
CheckSmatch                   WARNING   356.62 seconds
bluezmakeextell               PASS      120.00 seconds
IncrementalBuild              PASS      1372.16 seconds
ScanBuild                     PASS      1008.59 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
tools/hex2hcd: fix musl compatibility
ERROR:OPEN_BRACE: open brace '{' following function definitions go on the next line #64: FILE: tools/hex2hcd.c:288:
+static const char *helper_basename(const char *path) {

WARNING:LEADING_SPACE: please, no spaces at the start of a line #65: FILE: tools/hex2hcd.c:289:
+ const char *base = strrchr(path, '/');$

WARNING:LINE_SPACING: Missing a blank line after declarations #66: FILE: tools/hex2hcd.c:290:
+ const char *base = strrchr(path, '/');
+ return base ? base + 1 : path;

WARNING:LEADING_SPACE: please, no spaces at the start of a line #66: FILE: tools/hex2hcd.c:290:
+ return base ? base + 1 : path;$

/github/workspace/src/src/13729245.patch total: 1 errors, 3 warnings, 19 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/src/13729245.patch has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO

NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.

##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
tools/hex2hcd.c:135:26: warning: Variable length array is used.

---
Regards,
Linux Bluetooth