Confirming a DIFF bug
by joejobs from LinuxQuestions.org on (#5C841)
Hello,
I think I found a bug in DIFF last version (2.8.7) - I'm using it on Windows (from gnuwin32) and I would like to share it in order to make sure it is indeed a bug and I am not making a mistake
Download "a.txt" from here - https://pastebin.com/MPvv83wi
Download "b.txt" from here - https://pastebin.com/QhzufK6E
Then use this command:
diff a.txt b.txt | grep "14:53"
the result is
< |date=12 July |time=14:53:36
> |date=12 July |time=14:53:36
and this result is wrong. The output should be empty instead.
If you delete the first line in the file "a.txt" (which does not contain the string "14:53"), then the result is correct - nothing in the output
Another way to check the bug is this:
diff a.txt b.txt | grep "<" | cut -c3- > c.txt
diff a.txt c.txt | grep "<" | cut -c3- > d.txt
The file d.txt should be the same with b.txt
but it is not.
However, if you delete the first line in a.txt, the result is correct
The original "a.txt" file was much bigger when I found this bug, I tried to make it as small as possible but I can't make it shorter than it's current size.
I used DIFF on Windows for many years and it worked very well, never had any problem. This is the first time when it acts weird for me.
Can anyone confirm this bug?
Thanks


I think I found a bug in DIFF last version (2.8.7) - I'm using it on Windows (from gnuwin32) and I would like to share it in order to make sure it is indeed a bug and I am not making a mistake
Download "a.txt" from here - https://pastebin.com/MPvv83wi
Download "b.txt" from here - https://pastebin.com/QhzufK6E
Then use this command:
diff a.txt b.txt | grep "14:53"
the result is
< |date=12 July |time=14:53:36
> |date=12 July |time=14:53:36
and this result is wrong. The output should be empty instead.
If you delete the first line in the file "a.txt" (which does not contain the string "14:53"), then the result is correct - nothing in the output
Another way to check the bug is this:
diff a.txt b.txt | grep "<" | cut -c3- > c.txt
diff a.txt c.txt | grep "<" | cut -c3- > d.txt
The file d.txt should be the same with b.txt
but it is not.
However, if you delete the first line in a.txt, the result is correct
The original "a.txt" file was much bigger when I found this bug, I tried to make it as small as possible but I can't make it shorter than it's current size.
I used DIFF on Windows for many years and it worked very well, never had any problem. This is the first time when it acts weird for me.
Can anyone confirm this bug?
Thanks