Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 May 2023 23:09:11 +0200
From:      Steffen Nurpmeso <steffen@sdaoden.eu>
To:        Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= <des@FreeBSD.org>
Cc:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   Re: git: 09aee570980b - main - tsort: Add unit tests.
Message-ID:  <20230510210911.Hkz2z%steffen@sdaoden.eu>
In-Reply-To: <202305101346.34ADkIp8021360@gitrepo.freebsd.org>
References:  <202305101346.34ADkIp8021360@gitrepo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Hello.

Dag-Erling Sm=C3=B8rgrav wrote in
 <202305101346.34ADkIp8021360@gitrepo.freebsd.org>:
 |URL: https://cgit.FreeBSD.org/src/commit/?id=3D09aee570980b7eca6e3c902a66=
f\
 |6db129b8c7376
 |
 |commit 09aee570980b7eca6e3c902a66f6db129b8c7376
 |Author:     Dag-Erling Sm=C3=B8rgrav <des@FreeBSD.org>
 |AuthorDate: 2023-05-10 13:45:44 +0000
 |Commit:     Dag-Erling Sm=C3=B8rgrav <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=3D1617

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20230510210911.Hkz2z%steffen>