Bug 63789 - unexpected diff output.
Summary: unexpected diff output.
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: diffutils
Version: 7.3
Hardware: i386
OS: Linux
low
low
Target Milestone: ---
Assignee: Tim Waugh
QA Contact: Aaron Brown
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-04-18 19:08 UTC by Ben Levenson
Modified: 2005-10-31 22:00 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2002-04-18 22:30:27 UTC
Embargoed:


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

Description Ben Levenson 2002-04-18 19:08:28 UTC
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 19:09:25 UTC
Created attachment 54424 [details]
diff output

Comment 2 Tim Waugh 2002-04-18 19:22:10 UTC
Please attach the diff inputs. (If you can find minimal inputs that trigger 
this, even better.)  Thanks.

Comment 3 Ben Levenson 2002-04-18 22:24:13 UTC
Created attachment 54464 [details]
short file A

Comment 4 Ben Levenson 2002-04-18 22:30:23 UTC
Created attachment 54465 [details]
short file B

Comment 5 Tim Waugh 2002-04-19 12:10:00 UTC
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 12:16:14 UTC
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.