Diffing compressed tarballs

Rainer Müller raimue at macports.org
Fri Sep 9 18:48:11 PDT 2011


On 2011-09-10 02:28 , Ryan Schmidt wrote:
> On Sep 9, 2011, at 19:19, Arno Hautala wrote:
>> I'm thinking it's probably an issue
>> of BSD vs GNU. I'm installing gnutar right now to see if that fares
>> any better.
> 
> gnutar does not produce an error, but I also still don't see a diff.

I took a quick look and the problem is in line 172:

  my $list = `tar -C $tempdir $flag -xvf $tarball 2>/dev/null`;

The script expects to read the list of files in the archive into a
variable. But BSD tar outputs this to the stderr, while GNU tar outputs
to stdout. The redirect at the end just disregards the output from BSD.
The output format of both differs as well, BSD adds an "x" in front of
every line.

A quick fix would be to force gnutar here. Just replace tar with gnutar.
A proper, more portable solution would probably involve using a perl
module instead, such as Archive::Tar [1].

But the issue without an enclosing directory remains and I guess this is
the cause why you do not see any output. Have you tried with different
set of tarballs?

This works for me:

$ wget http://distfiles.macports.org/MacPorts/MacPorts-2.0.{2,3}.tar.bz2
...
$ tardiff --modified --stats MacPorts-2.0.2.tar.bz2 MacPorts-2.0.3.tar.bz2
/ ChangeLog                                         (    7 + /     0 -)
/ config/macports_version                           (    0 + /     0 -)
/ configure                                         (   53 + /     1 -)
/ src/pextlib1.0/sha256cmd.c                        (    5 + /     1 -)
/ src/pextlib1.0/sha256cmd.h                        (    5 + /     1 -)
/ src/port1.0/portfetch.tcl                         (   17 + /    10 -)
/ src/registry2.0/receipt_sqlite.tcl                (    4 + /     0 -)

Be warned, I just discovered that the short forms "-m -s" do not produce
the same output. Filed a patch in ticket #31200 [2].

The diffstat looks broken as well, at least for config/macports_version.
Actually, one line has been changed...?

Rainer

[1] http://perldoc.perl.org/Archive/Tar.html
[2] http://trac.macports.org/ticket/31200


More information about the macports-dev mailing list