psini has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks,

I've had a strange problem using Archive::Zip's method extractTree on an odt file generated with an ancient OpenOffice 2.0.4 (Debian Etch)

When extractTree extracts the subdirs, they have not the correct permissions (no "x" flag) so extractTree exits because cannot write in them.

Am I doing something wrong or it is a bug of Archive::Zip or OpenOffice file format?

I googled, but found nothing.

Updated: 'x' as in executable not 'd' as in directory. Sorry.

Rule One: "Do not act incautiously when confronting a little bald wrinkly smiling man."

Replies are listed 'Best First'.
Re: Archive::Zip & OpenOffice odt files
by Anonymous Monk on Jul 16, 2009 at 18:26 UTC
    I would check your umask, because Archive::Zip::FAQ says
    File ownership/permissions/ACLS/etc

    Q: Why doesn't Archive::Zip deal with file ownership, ACLs, etc.?

    A: There is no standard way to represent these in the Zip file format. If you want to send me code to properly handle the various extra fields that have been used to represent these through the years, I'll look at it.

      Well, not exactly...

      First, if I repack the odt file using unzip+zip from shell, Archive::Zip works fine.

      Second, it is not a problem of file ownership, it is that it creates directories in which it itself cannot write, and this, in my opinion, is an anomaly.

      On the other hand, if I use umask to set the x flag, then all the files would be marked as executable, and this would be an anomaly, too.

      Rule One: "Do not act incautiously when confronting a little bald wrinkly smiling man."