Archive Utility and ditto fail to expand valid .zip files with dir entries

Originator:tempelmann
Number:rdar://27398797 Date Originated:18-Jul-2016
Status:closed (not a bug) Resolved:
Product:OS X Product Version:10.12, 10.11.5
Classification:Other bug Reproducible:Always
 
Summary:
When a zip file contains entries that describe a folder instead of a file, they cannot be expanded with OSX's standard tool for this task.

That is a bug because there's good reasons to include dir entries in a zip file, i.e. to specify custom attributes on them, such as permissions. And it happens.

Also, the pkzip standard that ditto should follow allows this (see below). So, ditto fails to adhere to the standard and is causing grief for users, forcing them to search for other tools.

Attached is an example zip file that won't uncompress. In fact, that's the official zlib source code, which is the base for the zip format. Not being able to unpack this is a bit ironic, isn't it?

Version:
10.11.5, 10.12 beta 2

Notes:
It has been reported at least once before (rdar://8769517), but that earlier report fails to explain why this is a bug in ditto.

When I reported this issue to Mark Adler last week, he suggested to report this to Apple, so I do this now. Mark Adler is the original zip tool autor. He understands this best and he agrees this is a bug in ditto.

BTW, if you need an engineer for this, I'm available (I've written my own zip code in the past, not built on the variously available open source solutions that are already available, so I'm a bit of an expert on this, too).

--- added for openradar ---

The file can be downloaded here: http://files.tempel.org/zlib/rdar_27398797/zlib128-dll.zip
This is the same file as it was offered on zlib.org until mid-July, when it was replaced with a version that doesn't upset Apple's Unarchiver any more.

Comments

Response from Apple

There are no plans to address this based on the following:

The standard OS tool for unzip'ing a zip archive is zip/unzip, not ditto. ditto has never claimed to support modern zip archives. Use zip/unzip instead.

zip/unzip do work just fine:

[Thu Jul 28 08:14 AM] CoreXBS.git(297)$ cd /tmp/fuu [Thu Jul 28 08:14 AM] fuu(298)$ unzip ../zlib128-dll.zip Archive: ../zlib128-dll.zip inflating: DLL_FAQ.txt
creating: include/ creating: lib/ inflating: README.txt
creating: test/ inflating: USAGE.txt
inflating: zlib1.dll
inflating: include/zconf.h
inflating: include/zlib.h
inflating: lib/zdll.lib
inflating: lib/zlib.def
inflating: test/example_d.exe
inflating: test/minigzip_d.exe
[Thu Jul 28 08:15 AM] fuu(299)$ ls -lha total 272 drwxr-xr-x 9 alind wheel 306B Jul 28 08:15 . drwxrwxrwt 33 root wheel 1.1K Jul 28 08:14 .. -r--r--r-- 1 alind wheel 18K May 31 2012 DLL_FAQ.txt -rw-r--r-- 1 alind wheel 1.9K Jun 14 2012 README.txt -r--r--r-- 1 alind wheel 2.8K May 31 2012 USAGE.txt dr-xr-xr-x 4 alind wheel 136B Jun 14 2012 include dr-xr-xr-x 4 alind wheel 136B Jun 14 2012 lib dr-xr-xr-x 4 alind wheel 136B Jun 14 2012 test -rw-r--r-- 1 alind wheel 105K Jun 14 2012 zlib1.dll

We are now closing this report.

By tempelmann at July 29, 2016, 9:06 a.m. (reply...)

My response

Okay, fair enough to say that ditto is fine that way.

BUT: Archive Utility, which apparently uses ditto and not zip, also causes this problem. Which means that some .zip files, like the one I sent you, when double clicked in the Finder, do not expand. So the bug is with Archive Utility: A user should be able to expect that his VALID .zip files get expanded when double clicked. And that's not the case.

If Archive Utility uses ditto for this task, and ditto does not support all kinds of zip files, then it's Archive Utility fault to use the wrong tool here.

I only included ditto in the bug report to assist identifying the relationships of this bug, e.g. when searching for this issue. The REAL problem is Archive Utility here.

So, please re-open this. Otherwise, I'll open a new bug report that doesn't mention ditto.

By tempelmann at July 29, 2016, 9:11 a.m. (reply...)

Apple suggests I open a new report that does not mention ditto. Which I'd done here: http://www.openradar.me/27655515

By tempelmann at Aug. 2, 2016, 10:50 a.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!