On 02/11/2026 12:41, Bruno Haible wrote:
Pádraig Brady wrote:
We wouldn't want certain configs to fall back to
finding programs in the current directory.

In this case, when confstr (_CS_PATH) is longer than expected,
I would prefer
   - either an abort(),

Best not do that in a lib I think.

   - or a 'struct string_buffer', so that we don't use heap allocation
     in the normal case.
We could use heap allocation only in the edge case where 256 is not enough,
or even xmalloca(), though I'd keep it as simple as possible for this
extreme edge case.

If confstr returns 0, then we could use the glibc default of "/bin:/usr/bin"
or maybe just return NULL, as it's also an extreme edge case.

BTW I see that glibc before 2.24 (2016) used to prepend
an empty (current directory) entry to CS_PATH in the NULL case.
I also see that glibc's posix_spawnp() for hurd hasn't been updated
to match the current behavior and so is buggy and inconsistent
with its own execvp().

cheers,
Padraig

Reply via email to