Skip to content

Conversation

@maribu
Copy link
Member

@maribu maribu commented Aug 22, 2025

Contribution description

newlib and picolibc already implicitly add the 0x prefix for %p just as glibc does, and some of our tests scripts depend on this.

(And subjectively, this looks better.)

This adds mpaland/printf#90 on top of our patches.

Testing procedure

Combined with

diff --git a/tests/core/msg_queue_print/tests/01-run.py b/tests/core/msg_queue_print/tests/01-run.py
index a03118d268..f78b50870e 100755
--- a/tests/core/msg_queue_print/tests/01-run.py
+++ b/tests/core/msg_queue_print/tests/01-run.py
@@ -41,12 +41,12 @@ def expect_some(child, size, avail, range_start):
 
 def expect_content(child, counter):
     if counter == 0:
-        if os.environ.get('BOARD') in ['native', 'native32', 'native64']:
-            child.expect_exact('type: 0x0000, content: 0 ((nil))')
-        else:
-            child.expect(r'type: 0x0000, content: 0 \((0x)?0+\)')
+        child.expect(r'type: 0x0000, content: 0 \((\(nil\)|0x0+\))')
     else:
-        child.expect_exact(f'type: 0x{counter:04x}, content: {counter} (0x{counter:x})')
+        child.expect(r'type: (0x[a-fA-F0-9]+), content: (\d+) \((0x[a-fA-Z0-9]+)\)')
+        assert int(child.match.group(1), 16) == counter, f"Expected {counter:x} as type, got child.match.group(1)"
+        assert int(child.match.group(2)) == counter, f"Expected {counter} as content, got child.match.group(2)"
+        assert int(child.match.group(3), 16) == counter, f"Expected {counter:x} as ptr, got child.match.group(3)"
 
 
 def testfunc(child):

The failing test in the nightly should pass again

Issues/PRs references

newlib and picolibc already implicitly add the `0x` prefix for `%p` just
as glibc does, and some of our tests scripts depend on this.

(And subjectively, this looks better.)

This adds mpaland/printf#90 on top of our
patches.
@maribu maribu requested a review from mguetschow August 22, 2025 09:24
@github-actions github-actions bot added the Area: pkg Area: External package ports label Aug 22, 2025
@crasbe crasbe added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Aug 22, 2025
@crasbe
Copy link
Contributor

crasbe commented Aug 22, 2025

Maybe you can ping the devs in the mpaland-printf repository that this is still relevant? 🤔
Nevermind... the development seems to be pretty stalled..

@maribu
Copy link
Member Author

maribu commented Aug 22, 2025

Yes, sadly. But the test suite is actually pretty extensive, so I think we might have already caught all relevant unfixed bugs with our set of patches.

@crasbe
Copy link
Contributor

crasbe commented Aug 22, 2025

Don't jinx it 🤣

@maribu maribu enabled auto-merge August 22, 2025 12:32
@riot-ci
Copy link

riot-ci commented Aug 22, 2025

Murdock results

✔️ PASSED

9673e36 pkg/mpaland-printf: format points like glibc

Success Failures Total Runtime
10536 0 10536 21m:43s

Artifacts

@maribu maribu added this pull request to the merge queue Aug 22, 2025
Merged via the queue into RIOT-OS:master with commit e49b7fd Aug 22, 2025
28 checks passed
@maribu maribu deleted the pkg/mpaland-printf/format-pointer-like-glibc branch November 1, 2025 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: pkg Area: External package ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants