coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sort: prefer posix_spawnp to fork and execlp


From: Collin Funk
Subject: Re: sort: prefer posix_spawnp to fork and execlp
Date: Mon, 27 Oct 2025 18:05:27 -0700
User-agent: Gnus/5.13 (Gnus v5.13)

PƔdraig Brady <P@draigBrady.com> writes:

> The last case is what worries me.
> The failure isn't diagnosed. Also SIGPIPE is common and usually not diagnosed.
> Whether 2 or 3 occurs depends on how much is written to the failed 
> compressors.
> I can trigger 3. 100% of the time here without valgrind
> by increasing the buffer size (amount written) to 100K.
>
> Consider for example:
>
>   $ printf '%s\n' '#!/bin/sh' 'exit 1' > exit1 && chmod a+x exit1
>   $ src/sort -S 100K --compress-program=./exit1 Makefile | head -n1
>   $ echo $?
>   0
>
> No diagnostics or failure code etc.
> We'll need to address that.

FWIW it doesn't seem like this is a new bug:

    $ /bin/sort --version | head -n 1
    sort (GNU coreutils) 9.6
    $ /bin/sort -S 100K --compress-program=./exit1 Makefile
    sort: './exit1' [-d] terminated abnormally
    $ /bin/sort -S 100K --compress-program=./exit1 Makefile
    sort: './exit1' [-d] terminated abnormally
    $ /bin/sort -S 100K --compress-program=./exit1 Makefile
    $ /bin/sort -S 100K --compress-program=./exit1 Makefile
    $ /bin/sort -S 100K --compress-program=./exit1 Makefile

So, on the bright side it seems my patch lets us consistently have the
wrong behavior?

Collin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]