Re: [PATCH 0/3] tools/nolibc: fix standard conformance of a few string functions

From: Thomas Weißschuh

Date: Thu Nov 26 2026 - 02:49:47 EST


On 2026-11-25 12:14:50-0600, Arav Verma wrote:
> A few nolibc functions deviate from the C standard in corner cases:
> strchr()/strrchr() do not find the terminating NUL, strstr() returns
> NULL for an empty needle, and atoi()/atol() do not skip leading
> whitespace or accept a '+' sign.
>
> Fix them and add test cases. The new tests fail without the fixes. The
> results were also compared against glibc.
>
> Arav Verma (3):
> tools/nolibc: fix strchr() and strrchr() for the NUL terminator
> tools/nolibc: fix strstr() with an empty needle
> tools/nolibc: make atoi() and atol() skip whitespace and accept '+'

Thanks! Applied.

I also verified the new tests against musl.

> tools/include/nolibc/stdlib.h | 5 +++++
> tools/include/nolibc/string.h | 12 +++++-------
> tools/testing/selftests/nolibc/nolibc-test.c | 9 +++++++++
> 3 files changed, 19 insertions(+), 7 deletions(-)