GNU bug report logs -
#31472
tsort reporting false loop in input. unix2dos fixes the problem.
Previous Next
Reported by: Ivan Ivanov <wankata <at> ivanovi.net>
Date: Wed, 16 May 2018 10:43:04 UTC
Severity: normal
Tags: notabug
Done: Assaf Gordon <assafgordon <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
On 05/16/2018 11:23 AM, Ivan Ivanov wrote:
> Hi all,
>
> tsort is reporting loop in my input file, but the loop doesn't exist
> really.
>
> I have checked this manually, examining the contents of the file,
> related to the reported loop.
>
> Further more, if I run the input file trhough unix2dos – it works, so I
> suspect some strange problem with the unix newlines.
>
> The input file is generated with python script on the Ubuntu 16.04.3 so
> all newlines should be the same.
>
> Test environments (acting the same way):
> ---------------------------------------
>
> Ubuntu 16.04.3 LTS
> tsort (coreutils) 8.25
>
> and
>
> Debian GNU/Linux 9 (stretch)
> tsort (coreutils) 8.26
>
>
> Reproduction steps:
> ---------------------------------------
> $ unxz for-tsort-bug-example.txt.xz
> $ tsort for-tsort-bug-example.txt > /dev/null
>
> the above command should produce:
> tsort: for-tsort-bug-example.txt: input contains a loop:
> tsort: 15731101
> tsort: 15731102
The problematic lines are:
$ grep -E '15731101|15731102' for-tsort-bug-example.txt
15731102 16019755
15731102 15731104
15731102 15731101
15731102 15731105
15731102 15731103
15731101
15731102
Therefore your example reduces to:
$ grep -E '15731101|15731102|16019755|15731104|15731105|15731103' for-tsort-bug-example.txt
15731102 16019755
15731102 15731104
15731102 15731101
15731102 15731105
15731102 15731103
15731101
15731102
> $ cat for-tsort-bug-example.txt | unix2dos | tsort > /dev/null
This replaces "\n" by "\r\n", and of course changes the way tsort works.
If your suspicion was that the file has Windows-style line-endings, then
you would have had to use 'dos2unix'.
Have a nice day,
Berny
This bug report was last modified 6 years and 290 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.