Re: git: 09aee570980b - main - tsort: Add unit tests.
- In reply to: Dag-Erling Smørgrav : "git: 09aee570980b - main - tsort: Add unit tests."
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 10 May 2023 21:09:11 UTC
Hello.
Dag-Erling Smørgrav wrote in
<202305101346.34ADkIp8021360@gitrepo.freebsd.org>:
|URL: https://cgit.FreeBSD.org/src/commit/?id=09aee570980b7eca6e3c902a66f\
|6db129b8c7376
|
|commit 09aee570980b7eca6e3c902a66f6db129b8c7376
|Author: Dag-Erling Smørgrav <des@FreeBSD.org>
|AuthorDate: 2023-05-10 13:45:44 +0000
|Commit: Dag-Erling Smørgrav <des@FreeBSD.org>
|CommitDate: 2023-05-10 13:45:44 +0000
|
| tsort: Add unit tests.
...
| Differential Revision: https://reviews.freebsd.org/D40043
...
|+cycle_body()
|+{
|+ cat >input <<EOF
|+A B
|+A F
|+B C
|+B D
|+D E
|+D A
|+EOF
|+ cat >output<<EOF
|+D
|+E
|+A
|+F
|+B
|+C
|+EOF
As i saw it fly by there was [1], and already the next
POSIX[.1-2023?] will (i think) say
If a cycle is found in the input, diagnostic or warning
messages shall be written to standard error reporting that
there is a cycle and indicating which nodes are in the
cycle(s). If the -w option is specified, these messages shall
be diagnostic messages. If a diagnostic message is written,
the final exit status shall be non-zero.
(The -w option was also added.)
[1] https://austingroupbugs.net/view.php?id=1617
Linux tools all fail and do not try to resolve cycles at all.
#?0|kent:$ cat <<_EOT | tsort # GNU coreutils
> A B
> A F
> B C
> B D
> D E
> D A
> _EOT
tsort: -: input contains a loop:
tsort: A
tsort: B
tsort: D
A
F
B
D
C
E
#?1|kent:$ cat <<_EOT | busybox.static tsort
A B
A F
B C
B D
D E
D A
_EOT
tsort: cycle at A
A
F
B
D
E
C
(Greetings to the island of happy red devils.)
--steffen
|
|Der Kragenbaer, The moon bear,
|der holt sich munter he cheerfully and one by one
|einen nach dem anderen runter wa.ks himself off
|(By Robert Gernhardt)
|~~
|..and in spring, hear David Leonard sing..
|
|The black bear, The black bear,
|blithely holds his own holds himself at leisure
|beating it, up and down tossing over his ups and downs with pleasure
|~~
|Farewell, dear collar bear