bug#79232: tsort doesn't support -w added by POSIX 2024.
From:
Collin Funk
Subject:
bug#79232: tsort doesn't support -w added by POSIX 2024.
Date:
Wed, 13 Aug 2025 22:01:09 -0700
User-agent:
Gnus/5.13 (Gnus v5.13)
Collin Funk <collin.funk1@gmail.com> writes:
> I'll have a look at implementing this behavior. But figured it was worth
> sending on bug-coreutils for tracking like the rest of the missing POSIX
> 2024 features.
I have attached a proposed patch.
I followed the POSIX recommendation of using the exit status 0 - 124 for
the number of cycles and 125 for program errors (e.g. closing standard
output).
But I have hidden the 125 exit status behind POSIXLY_CORRECT. To avoid
breaking something like this:
tsort input-file
if test $? -eq 1; then
echo do something
fi
However, that means that when POSIXLY_CORRECT is not defined the exit
status is ambiguous as shown in the following example:
# Input with a cycle.
$ printf 'a b\nb a\n' | ./src/tsort
tsort: -: input contains a loop:
tsort: a
tsort: b
a
b
$ echo $?
1
# Program error.
$ echo 'a a' | ./src/tsort > /dev/full
tsort: write error: No space left on device
$ echo $?
1
If we can agree on that behavior, I'll probably move tests/misc/tsort.pl
to a separate tsort directory in tests. And then add a shell script to
test the behavior of POSIXLY_CORRECT on the exit status using /dev/full.
Collin