Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2007
    Location
    Scarborough
    Posts
    15

    Exclamation Updating a file in a zip changes/removes permissions

    Recently, I've been using Cirrus (build 445) to update the contents of zips.

    I was able to copy a file from one zip to another using the Folder Compare view, and the resulting file was created in the updated zip with permissions set to 644. The source file was 664, not 644, but at leat the file was owner-read&writeable. Changing the group perm from 6 to 4 seems like a bug, but it's tolerable.

    However, I wanted to update an .xml file inside a .zip. In the source zip, linux file permissions were 664. After using the Text Compare editor to change the file, the file in the zip was changed to have permission 000.

    Now, granted, zip files don't normally have permissions as such (unlike a .tar), and on Windows this is irrelevant, but on Linux, setting the file permission to 000 means the file can't be read once unpacked. (Yes, I can run chmod on it after it's unpacked, but that's not user friendly, nor is it expected that you'd have to do so after unzipping an archive.)

    I ran into this problem recently in creating .zip files using Apache's Ant on Linux -- the solution there was to explicitly set the dirmode and filemode when adding files to a zip:

    <zip destfile="${buildDirectory}/${buildLabel}/${SDKZip}" update="true">
    <zipfileset src="${buildDirectory}/${buildLabel}/${masterZip}" dirmode="775" filemode="664" id="SDKZipFiles" />
    </zip>

    Can a similar solution work for creating/updating files in zips?

    Or, simpler, can you just ensure that the permissions before the file-edit or copy-into are maintained in the resulting archive if the available zip implementation is able to store permission data?

  2. #2
    Join Date
    Nov 2007
    Location
    Scarborough
    Posts
    15

    Default

    By the way, trying to update the permissions on the xml file in the zip yielded this in the log:

    02/17/08 01:12:06 AM Unable to set attributes of feature.xml: Container does not support requested file operation
    02/17/08 01:12:06 AM Failed to set attributes on 1 items. Completed in 0.11 seconds.

  3. #3
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    2,505

    Default

    Our current implementation doesn't support Unix attributes in zips and always assumes the external attributes are DOS attributes. If you send us a small zip with a couple files and a directory that contains Unix attributes I'll see if I can fix that.
    ZoŽ P Scooter Software

  4. #4
    Join Date
    Nov 2007
    Location
    Scarborough
    Posts
    15

    Default unix-packed zip with some text files & various permissions

    This zip contains 3 folders and 8 files, all with various permissions.

    http://filebin.ca/zvjbph/tmp.zip

    $ ll *
    -rw-r--r-- 1 nickb users 4 Feb 17 11:58 foo.txt
    -rw-r--r-- 1 nickb users 4 Feb 17 11:58 bar.txt
    drwxrwxr-x 2 nickb users 4.0K Feb 17 11:59 dir1
    drwxrwx--- 2 nickb users 4.0K Feb 17 11:59 dir2
    drwx------ 2 nickb users 4.0K Feb 17 11:59 dir3

    dir1:
    total 8.0K
    -rw-rw-r-- 1 nickb users 4 Feb 17 11:59 foo.txt
    -rw-rw-r-- 1 nickb users 4 Feb 17 11:59 bar.txt

    dir2:
    total 8.0K
    -rwxrwx--- 1 nickb users 4 Feb 17 11:59 foo.txt
    -rwxrwx--- 1 nickb users 4 Feb 17 11:59 bar.txt

    dir3:
    total 8.0K
    -rwx------ 1 nickb users 4 Feb 17 11:59 foo.txt
    -rwx------ 1 nickb users 4 Feb 17 11:59 bar.txt

  5. #5
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,616

    Default

    Thanks, Nick. I've logged the issue.
    Aaron P Scooter Software

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •