Re: [PATCH 2/3] selftests/nolibc: cast execve() argv string to character pointer
From: Thomas Weißschuh
Date: Fri May 22 2026 - 11:01:55 EST
On 2026-05-21 19:15:58+0100, David Laight wrote:
> On Thu, 21 May 2026 18:29:30 +0200
> Thomas Weißschuh <linux@xxxxxxxxxxxxxx> wrote:
>
> > The existing code would trigger a warning under -Wwrite-strings which is
> > about to be enabled. execve() is specified as not modifying the argv
> > array, but the exact semantics are not representable in the type system.
>
> I suspect you'll have to fix it again to avoid 'casting away const'.
Where would this warning be coming from? Which compiler flags are needed?
Afaik it is legal to cast away const.
> Can you use something like (char[]){"/"} ?
That looks good. However if this issue is real we will also have it in
nolibc's errno.h. There I don't want to use this pattern, as it requires
more memory.
(...)
Thomas