Re: patch for lib/Archive/Extract.pm for EBCDIC platform "Jos I. Boumans"  wrote 2007-10-25 17:25:07:

> Hello Chun,
> 
> On 25 Oct 2007, at 07:37, Chun Bing Ge wrote:
> 
> > Here is the patch below. Any question, pls let me know, thanks.
> 
> My question is: what is this patch for? what problem does it fix and 
> where
> is this problem demonstrated?
> 
> If i read the patch correctly, the only change is the '-o' flag for / 
> bin/tar.
> According to the docs, -o does:
> 
>    Compatibility options:
>      -o                                 when creating, same as --old- 
> archive
>                                         when extracting, same as --no- 
> same-owner
> 
>      --no-same-owner          extract files as yourself
> 
> Why is this necessary? How does that fix ebdic problems? Is ord("A") 
> == 193
> the ebdic test? Is there any other commands that need to be changed 
> for this?
> 
> Please explain :)
> 

Yes, ord("A") == 193  is the EBCDIC test.

On z/OS, "tar" will save the original ownership of the tar file 
when extracting by default, so if using "tar -xf filename.tar", 
"tar" will create files/directories that could not be removed.
If using "-o" to extract the tar file, we could .

I copy the docs of  the "-o" option of "tar" on z/OS:
  o    When writing files to an archive, does not record owner and modes 
of
       directories in the archive. If this is specified when extracting 
from
       an existing ar archive, tar does not restore any owner and group
       information in the archive. The default is to record this 
information
       when creating a tar archive, and to restore it when extracting from
       the archive.

FYI. If you have any (other) question, please let me know. I'd like to 
hear from you.

Thanks a lot.
> 
> >
> > --- /home/spring/perl/perl-current/lib/Archive/Extract.pm 
> > 2007-04-12
> > 22:35:04.000000000 +0800
> > +++ /home/spring/patch/chgfile/lib-Archive-Extract.pm   2007-10-08
> > 15:32:09.000000000 +0800
> > @@ -527,12 +527,23 @@
> >      }
> >
> >      ### now actually extract it ###
> > -    {   my $cmd =
> > +    {   my $cmd;
> > +         if (ord("A") == 193) {
> > +               $cmd =
> > +            $self->is_tgz ? [$self->bin_gzip, '-cdf', $self->archive,
> > '|',
> > +                             $self->bin_tar, '-xof', '-'] :
> > +            $self->is_tbz ? [$self->bin_bunzip2, '-c', $self- 
> > >archive,
> > '|',
> > +                             $self->bin_tar, '-xof', '-'] :
> > +            [$self->bin_tar, '-xof', $self->archive];
> > +         }
> > +         else {
> > +               $cmd =
> >              $self->is_tgz ? [$self->bin_gzip, '-cdf', $self->archive,
> > '|',
> >                               $self->bin_tar, '-xf', '-'] :
> >              $self->is_tbz ? [$self->bin_bunzip2, '-c', $self- 
> > >archive,
> > '|',
> >                               $self->bin_tar, '-xf', '-'] :
> >              [$self->bin_tar, '-xf', $self->archive];
> > +         }
> >
> >          my $buffer = '';
> >          unless( scalar run( command => $cmd,
> >
> >
> >
> > Ge, Chun Bing
> > ç©ºå±±æ°é¨åï¼å¤©æ°ææ¥ç§
> 
> --
> 
>    Jos Boumans
> 
>    How do I prove I'm not crazy to people who are?
> 

