Bug 63789 - unexpected diff output.
unexpected diff output.
Status: CLOSED NOTABUG
Product: Red Hat Linux
Classification: Retired
Component: diffutils (Show other bugs)
7.3
i386 Linux
low Severity low
: ---
: ---
Assigned To: Tim Waugh
Aaron Brown
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-04-18 15:08 EDT by Ben Levenson
Modified: 2005-10-31 17:00 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2002-04-18 18:30:27 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
diff output (66.10 KB, text/plain)
2002-04-18 15:09 EDT, Ben Levenson
no flags Details
short file A (695 bytes, text/plain)
2002-04-18 18:24 EDT, Ben Levenson
no flags Details
short file B (702 bytes, text/plain)
2002-04-18 18:30 EDT, Ben Levenson
no flags Details

  None (edit)
Description Ben Levenson 2002-04-18 15:08:28 EDT
Description of Problem:  
while trying to compare the package set between the re0417.1 tree and the 7.2  
distro, I received some unexpected diff results.  Occasionally, diff fails  
to properly handle the case where file A contains lines that are absent from  
file B (and vice versa).  
  
Version-Release number of selected component (if applicable):  
diffutils-2.7.2-5  
tree: re0417.1  
  
How Reproducible:  
100% -- see below (Additional Information)  
  
Steps to Reproduce:  
1. diff  new.txt 7.2-rhnlist.txt --side-by-side  
  
Actual Results:  
<snip>  
FreeWnn-libs-1.11-20     |     FreeWnn-libs-1.11-19  
GConf-1.0.9-4            |     GConf-1.0.4-3  
GConf-devel-1.0.9-4      |     GConf-devel-1.0.4-3  
Glide3-20010520-13       |     Gtk-Perl-0.7008-3  
Glide3-devel-20010520-13 |     Guppi-0.35.5-7  
Gtk-Perl-0.7008-13       |     Guppi-devel-0.35.5-7  
Guppi-0.40.3-5           |     ImageMagick-5.3.8-3  
Guppi-devel-0.40.3-5     |     ImageMagick-c++-5.3.8-3  
<snip>  
  
Expected Results:  
<snip>  
FreeWnn-libs-1.11-20     |     FreeWnn-libs-1.11-19  
GConf-1.0.9-4            |     GConf-1.0.4-3  
GConf-devel-1.0.9-4      |     GConf-devel-1.0.4-3  
Glide3-20010520-13       <  
Glide3-devel-20010520-13 <  
Gtk-Perl-0.7008-13       |     Gtk-Perl-0.7008-3  
Guppi-0.40.3-5           |     Guppi-0.35.5-7  
Guppi-devel-0.40.3-5     |     Guppi-devel-0.35.5-7  
<snip>  
  
Additional Information:  
This failure @ the Glide3 difference generates a huge diff stanza.  
This is 100% reproducible with the 2 text files I'm diff'ing, but it  
does behave as expected at other difference points:  
<snip>  
anaconda-7.3-5           |     anaconda-7.2-7  
anaconda-help-7.3-1      |     anaconda-runtime-7.2-7  
anaconda-images-7.3-5    <  
anaconda-runtime-7.3-5   <  
anacron-2.3-17                 anacron-2.3-17  
<snip>  
 
Full diff output to follow.
Comment 1 Ben Levenson 2002-04-18 15:09:25 EDT
Created attachment 54424 [details]
diff output
Comment 2 Tim Waugh 2002-04-18 15:22:10 EDT
Please attach the diff inputs. (If you can find minimal inputs that trigger 
this, even better.)  Thanks.
Comment 3 Ben Levenson 2002-04-18 18:24:13 EDT
Created attachment 54464 [details]
short file A
Comment 4 Ben Levenson 2002-04-18 18:30:23 EDT
Created attachment 54465 [details]
short file B
Comment 5 Tim Waugh 2002-04-19 08:10:00 EDT
Since all the lines here are different, the output is correct: 
 
FreeWnn-libs-1.11-20     |     FreeWnn-libs-1.11-19   
GConf-1.0.9-4            |     GConf-1.0.4-3   
GConf-devel-1.0.9-4      |     GConf-devel-1.0.4-3   
Glide3-20010520-13       |     Gtk-Perl-0.7008-3   
Glide3-devel-20010520-13 |     Guppi-0.35.5-7   
Gtk-Perl-0.7008-13       |     Guppi-devel-0.35.5-7   
Guppi-0.40.3-5           |     ImageMagick-5.3.8-3   
Guppi-devel-0.40.3-5     |     ImageMagick-c++-5.3.8-3   
 
The reason other sections of the output match your expectations is the 
presence of identical lines in the input.
Comment 6 Tim Waugh 2002-04-19 08:16:14 EDT
What you might want to try instead is this kind of thing:  
  
#!/bin/bash  
A=$1 
B=$2 
rm -rf .A 
mkdir .A 
while read line; do echo ${line#${line%-*-*}-} > .A/${line%-*-*}; done < $A 
rm -rf .B 
mkdir .B 
while read line; do echo ${line#${line%-*-*}-} > .B/${line%-*-*}; done < $B 
diff -du .A .B 
rm -rf .A .B

Note You need to log in before you can comment on or make changes to this bug.