On Thu, Nov 6, 2025 at 7:16 PM Bruno Haible via GNU coreutils General
Discussion <[email protected]> wrote:
>
> Pádraig Brady wrote:
> > > For a discussion of the predefines of SPARC, see
> > > maint-tools/platforms/predefines.txt in
> > > https://gitweb.git.savannah.gnu.org/gitweb/?p=gnulib/maint-tools.git
> >
> > Cool, so __sparc__ is always defined.
>
> No, __sparc__ is not always defined. __sparc is always defined.
>
> > 100% for me. Repro was in other mail with proposed patch:
> >
> >   # cfarm202
> >   $ ./configure gl_cv_func_posix_spawnp_secure_exec=no --quiet
> >   $ make -j $(nproc)
> >   $ make TESTS=tests/install/basic-1.sh SUBDIRS=. check
>
> I reproduce it. Smaller reproducer:
>   $ cd src
>   $ mkdir subdir
>   $ ./ginstall -s -c -m 555 dd subdir
>
> It crashes if and only if $PATH is long enough:
>
> $ export 
> PATH='/home/haible/foo:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/sbin:/usr/sbin'
> $ ./ginstall -s -c -m 555 dd subdir
>
> $ export 
> PATH='/home/haible/foooooooooooooooooooo:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/sbin:/usr/sbin'
> $ ./ginstall -s -c -m 555 dd subdir
> Segmentation fault
>
> The total size of other environment variables is irrelevant.
>
> So, this hints at this part of gnulib/lib/spawni.c as being the cause:
>
>   path = getenv ("PATH");
>   if (path == NULL)
>     ...
>
>   len = strlen (file) + 1;
>   pathlen = strlen (path);
>   name = alloca (pathlen + len + 1);
>
> Will continue investigating tomorrow...

alloca() looks like a red herring.  xmalloc() will likely fix the issue.

Jeff

Reply via email to