On Thursday 11 December 2003 12:33 pm, you wrote:

> "bad signature" errors (was: Archive::Zip 1.09 breaks PAR)
>  From: Autrijus Tang <[EMAIL PROTECTED]>
>  To: Roderich Schupp <[EMAIL PROTECTED]>
>  CC: PAR Mailing List <[EMAIL PROTECTED]>, "Ned Konz <[EMAIL PROTECTED]>"
>
> On Wed, Dec 10, 2003 at 01:01:13PM +0100, Roderich Schupp wrote:
> > the recently (27 Nov 2003) released Archive::Zip 1.09 doesn't get
> > quite get along with PAR 0.76.
> >
> > On WindowsXP, Perl 5.8.1, I get:
> >
> > C:\temp\cpan\build\PAR-0.76>pp -o hello.exe -e "print q[hello]"
> > C:\temp\cpan\build\PAR-0.76>hello.exe
> > format error: bad signature: 0x00905a4d at offset 0 in file
> > IO::File=GLOB(0xd9b02c) at -e line 660
> > format error: bad signature: 0x6e757220 at offset 100 in file
> > IO::File=GLOB(0xd9b02c) at -e line 159
> > format error: bad signature: 0x00000000 at offset 37 in file
> > IO::File=GLOB(0xd9b02c) at ../blib/lib/PAR.pm line 211
> > hello
>
> Thanks for finding the cause for this problem.  Archive::Zip 1.09 says
> this in its changelog:
>
>   - Always check for local header signatures before using them
>
> But for "padded" executables, of course it will have bad signatures,
> as it has a loader preceding it.

I don't see why that's the case. If you're making an application that prepends 
a loader, you should rewrite the EOCD headers with new offsets to make them 
match. You can't just stick arbitrary binary data in front of a zip file and 
still have it be a correct format.

> I think that self-extracting zip 
> files (i.e. unzipsfx) will also be affected.

Not if they're built properly.

Really, all you have to do is to use Archive::Zip to put the self-extracting 
stub at the front of the file (see my examples/selfex.pl for a trivial 
example).

> See Archive/Zip.pm line 376:
>
>     # compare with expected signature, if any, or any known signature.
>
> (Cc'ing the module author, Ned Konz.)
>
> Ned, is there a way for us to say "Please ignore $expected_signature,
> don't show those warnings" to Archive::Zip, either as a constructor
> parameter, or as a global config variable?
>
> I don't feel like to redefine key Archive::Zip subroutines, so if
> there can be a knob to turn off such checks, it will be appreciated.

You can define your own error handler if you want (see the manual).

-- 
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE

Reply via email to