The main reason that Module/Build/t/ppm.t is failing on VMS is because Archive::Tar was building a corrupt archive on VMS.

This patch fixes it so that Archive::Tar uses the amount of data read in from a file to set the size if it is larger than the value given from lstat.

It also fixes an issue where Archive::Tar was storing the wrong value in the UID field for the Archives, so it is compatible with the GNV GNU Tar 1.19 on VMS.

Todo:

  Chase down a similar bug in GNV GNU TAR for VMS format binary files.

  Come up with a way to store/restore VMS file attributes for
  both Archive::Tar and GNV GNU Tar.

  ppm.t is expecting the case of files to be preserved and needs to
  do case insensitive compares.

-John
[EMAIL PROTECTED]
Personal Opinion Only


--- /rsync_root/perl/lib/Archive/Tar/File.pm    Wed Aug 15 10:03:08 2007
+++ lib/Archive/Tar/File.pm     Sun Jun  1 00:12:43 2008
@@ -266,6 +266,30 @@
     my @items       = qw[mode uid gid size mtime];
     my %hash        = map { shift(@items), $_ } (lstat $path)[2,4,5,7,9];
 
+    if (ON_VMS) {
+        # VMS has two UID modes, traditional and POSIX.  Normally POSIX is
+        # not used.  We currently do not have an easy way to see if we are in
+        # POSIX mode.  In traditional mode, the UID is actually the VMS UIC.
+        # The VMS UIC has the upper 16 bits is the GID, which in many cases
+        # the VMS UIC will be larger than 209715, the largest that TAR can
+        # handle.  So for now, assume it is traditional if the UID is larger
+        # than 0x10000.
+
+        if ($hash{uid} > 0x10000) {
+            $hash{uid} = $hash{uid} & 0xFFFF;
+        }
+
+
+        # The file length from stat() is the physical length of the file
+        # However the amount of data read in may be more for some file types.
+        # Fixed length files are read past the logical EOF to end of the block
+        # containing.  Other file types get expanded on read because record
+        # delimiters are added.
+
+        my $data_len = length $data;
+        $hash{size} = $data_len if $hash{size} < $data_len;
+
+    }
     ### you *must* set size == 0 on symlinks, or the next entry will be
     ### though of as the contents of the symlink, which is wrong.
     ### this fixes bug #7937

Reply via email to