diff mbox series

tools/hex2hcd: fix musl compatibility

Message ID 20240710123002.5639-1-rahul@sandhuservices.dev (mailing list archive)
State Superseded
Headers show
Series tools/hex2hcd: fix musl compatibility | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch fail 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.
tedd_an/GitLint success Gitlint PASS
tedd_an/BuildEll success Build ELL PASS
tedd_an/BluezMake success Bluez Make PASS
tedd_an/MakeCheck success Bluez Make Check PASS
tedd_an/MakeDistcheck success Make Distcheck PASS
tedd_an/CheckValgrind success Check Valgrind PASS
tedd_an/CheckSmatch warning CheckSparse WARNING tools/hex2hcd.c:135:26: warning: Variable length array is used.
tedd_an/bluezmakeextell success Make External ELL PASS
tedd_an/IncrementalBuild success Incremental Build PASS
tedd_an/ScanBuild success Scan Build PASS

Commit Message

Rahul Sandhu July 10, 2024, 12:30 p.m. UTC
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(-)

Comments

bluez.test.bot@gmail.com July 10, 2024, 2:17 p.m. UTC | #1
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
diff mbox series

Patch

diff --git a/tools/hex2hcd.c b/tools/hex2hcd.c
index e6dca5a81..42c95b759 100644
--- a/tools/hex2hcd.c
+++ b/tools/hex2hcd.c
@@ -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;
 	}