zdiff problem

Bruce Dubbs bruce.dubbs at gmail.com
Sun May 17 18:49:55 PDT 2009

I'm trying to address ticket #2315 that says zdiff doesn't work.  I confirmed 
this by creating two files with a one line difference and compressing them:

gzip file1
gzip file2

But 'zdiff file1.gz file2.gz' gives no output.  Older versions of the script 
work properly.

The code in the script is really convoluted.   I found an error report in the 
gzip archives about this:


I note that there was never a reply to the message and that was over a year ago.

The problem code looks like:

   exec 4>&1
       (gzip -cdfq -- "$1" 4>&-; echo $? >&4) 3>&- |
     ( (gzip -cdfq -- "$2" 4>&-; echo $? >&4) 3>&- 5<&- </dev/null |
        eval "$cmp" /dev/fd/5 -) 5<&0

When I look at /dev/fd, I only have 0 through 3 (and on RH and Ubuntu other 
systems too, but none use gzip-1.3.12).

The fix appears to be changing the last line above to
    eval "$cmp" /dev/fd/5 - >&3) 5<&0
                           ^^^^    added

We can fix this with this with the following:

    sed -i 's/5 -)/5 >\&3)/' zdiff

but I don't understand what is really going one here.

Should I make this change?  Comments?

   -- Bruce

More information about the lfs-dev mailing list