Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Problem with Finder's "Compress"

I'm having a real problem in Leopard with the Compress option in Finder's File menu. After enabling the root user and logging in to it, I create a .zip file of a folder using the Compress option. If I then double-click this .zip file, it indeed uncompresses it, but all of the files and folders are owned by root, not the original owners.

This is decidedly not good, since I have used this mechanism for backup for a long time. Note that taking that same .zip file and unarchiving it (that's what previous operating systems called it) in Tiger, all of the files are owned by their original owners.

Does anyone know why this is so, or any way around the problem?

Power Mac G5, Mac OS X (10.5.4)

Posted on Nov 22, 2008 3:08 PM

Reply
29 replies

Nov 26, 2008 9:17 PM in response to red_menace

wouldn't the bug be in Tiger for adding that option? If for whatever reason you log in as root, then for whatever reason use the Finder to uncompress something that you wanted to be owned by root, how would you stop this behavior?


I'm guessing that you're thinking of root as just another user. (Or maybe your Mac has only one user.) But one of the reasons root exists is to provide a tool for a system administrator to do things that can't be done any other way. One of those things is to copy a set of files/folders owned by more than one user. To make a real copy, ownership (and permissions and ...) must be preserved. As a long-time system administrator, I can assure you that this kind of thing has to be done now and then. On the other hand, in my 18 years, I don't ever remember a time when I wanted to do what you describe; i.e., copy such a set of things but make the resultant files/folders all owned by root.

Furthermore, doing that really means you want to do two things: Make a copy AND change the owners. Now in Unix (i.e., in Terminal), root can easily change the owners. But that isn't normally what's wanted. (I don't know any way to change owners using Finder.)

And if you are going to have to use one of the various utilities to uncompress in the desired way, why use the Finder in the first place?


Well, but part of the point is, I didn't used to have to use a utility; Finder used to do it just fine.

But the really important point for me is, there needs to be SOME way for SOME account to make such a copy. That way used to be the Finder (un)Archive function executed as root. And I think that's the way Finder (un)Compress "ought" to operate. You can certainly disagree.

Nov 26, 2008 10:49 PM in response to frazzlejazz

Yes, I am aware of the root user, although I do usually think of it as an admin user doing something as root. Pretty much anything can be done from a regular admin account using sudo, so doing something like using the root account to compress with the Finder seems a bit odd (to me anyway), although I am a long way from being a system administrator.

This is part of what I was observing, in that usually (in other accounts) a zip file is unarchived with the permissions of the user, although using the unzip utility instead of the Finder gives you other options. Since Tiger apparently uses the -X option in the root account, it seems a bit backwards - the Finder then uses an option that in order to not use you need to use unzip, while Leopard doesn't use the option so you need to use unzip to include it. I don't use the root account at all, but I was thinking of the case where you would use the Finder to unzip some utilities or an application where you wanted the owner to be root, but the default is to preserve the original owner.

Nov 26, 2008 11:19 PM in response to biovizier

Hey Biovizier
This is completely unrelated to this thread. But I had to ask you a question regarding your post on a previous thread.
"http://discussions.apple.com/thread.jspa?messageID=6997442"
About filevault passwords - Now the issue was a person's macbook was locked by her relative using filevault & master password was set. And I fixed it using your method. Now at the login window of the user, there is a "Reset Password" option and when I try to reset the Master Password, it says "The user's previous keychain still exists...."
Does this the mean the person whoever locked the computer can still lock the computer again using the previous password?
I know can make that Reset Password option dissapear by deleting the FileVault.pref files but could that person use the old password to lock the computer again? Or is there a way to delete those preference files?

Nov 27, 2008 8:43 AM in response to red_menace

..." wouldn't the bug be in Tiger for adding that option?"...

I think it's important to make a distinction between a bug (something works differently from how it was intended due to eg. an error during programming), and a design decision that people may disagree with.

Since ' ditto' is supposed to, but fails to restore the ownership information in Leopard, and "Archive Utility.app" works through ' ditto', and since the ownership information is present in the archive that is created by "Archive Utility.app", and since ownership was restored by all of these methods (or their equivalents) in "Tiger", I'm assuming that ownership is intended to be preserved in Leopard but isn't preserved because of a bug. If someone knows of any new syntax for "Leopard" to do this, I would love to hear it, but right now, the closest approximation seems to be ' unzip' + ' FixupResourceForks' which creates an imperfect copy with alterred folder modification dates, so it does not appear to be possible to properly extract a "Finder" archive in Leopard at all. That can't be intentional.

Now, whether archiving, or copying in the "Finder" should or shouldn't preserve ownership is a whole other debate. I'm of the opinion that "root" should preserve ownership. "frazzlejazz" gives a good real-world account of why such a feature is desireable.

One important thing to keep in mind is that non-root user's can't preserve ownership even if they wanted to - they don't have the privileges so making everything owned by them is the best that they can do. The "root" user does have the privileges to preserve ownership, and they won't have any access issues no matter who owns the item so there is not inherent reason to change the ownership. With the ability to preserve ownership, they potentially can (with a few exceptions) make a perfect copy of a source folder (very handy for an administrator overseeing multiple accounts) and it seems to me that it would be a shame to cripple that ability just to make it the same as less privileged users.

..." If for whatever reason you log in as root, then for whatever reason use the Finder to uncompress something that you wanted to be owned by root, how would you stop this behavior?"...

Again, I find it difficult to imagine why someone logged in as "root" would need ownership of the files in an expanded archive. For less privileged users, it's a necessity, but not for "root" because they can already access anything. But I suppose if they really needed to, under Tiger, they could expand the archive (original ownership preserved), then copy the expaned folder (the new copy owned by "root"). For something with straightforward permissions like an application, the Tiger version of "Get Info" with the "Apply to enclosed items" should have sufficed, and you wouldn't even need to log into "root" to do it. For a more complex folder whose contents have different owners and permissions, and hypothetically, if the "Finder" also were to preserve ownership, then I suppose it would be necessary to go to the command line to change just the ownership to "root" without alterring permissions, but it would be possible to do so.

But look at the converse - once you have a folder where ownership of everything has been changed to "root", how do you get your perfect copy back? Once the specific ownership information is gone, it can't be restored, neither with the GUI nor the CLI. The best case scenario is you know what should belong to whom and go through each file and fix them individually.

So in terms of design decisions, I would go with the option to preserve as much information as possible in an archive, which for "root", means preserving ownership.

Nov 27, 2008 11:33 AM in response to red_menace

..." It appears that Leopard's Finder uses ditto's PKZIP option, which will unzip with permissions for the current owner."...

That shouldn't matter -- ' ditto' is supposed to preserve ownership when run as "root". That it fails to do so in Leopard for PKZip format archives is the bug.

..." Using ditto's default CPIO will uncompress preserving the original ownerships and permissions"...

True, but since the "Finder" uses the PKZip format, the fact that expansion of CPIO archives works correctly unfortunately won't help in the proper expansion of "Finder" archives in Leopard. Unless you're saying you figured out a way to get ' ditto' to do this...

Nov 28, 2008 4:40 PM in response to biovizier

I went to write up a bug report on this, and ran into something I just don't understand, mainly because it appears to contradict something you (biovizier) have said a number of times; and I've come to trust you a lot!

Since 'ditto' is supposed to, but fails to restore the ownership information in Leopard


I went to check to man page in Leopard for ditto, to make sure it still says it preserves ownership (without even requiring root to execute it 🙂, and it does. So I decided to just make sure it didn't actually preserve ownership as you said -- but it did!

-> uname -rv
9.5.0 Darwin Kernel Version 9.5.0: Wed Sep 3 11:31:44 PDT 2008; root:xnu-1228.7.58~1/RELEASE_PPC
-> whoami
root
-> ls -l testzips
total 0
-rwxr-x-w- 1 owner1 grp 0 Oct 27 12:53 a
-r-sr-s--t 1 owner1 grp 0 Oct 27 12:53 b
drwx------ 2 owner2 grp 68 Oct 27 12:53 c
-> ls -l /tmp/testzips
ls: /tmp/testzips: No such file or directory
Exit 1
-> ditto testzips /tmp/testzips
-> ls -l /tmp/testzips
total 0
-rwxr-x-w- 1 owner1 grp 0 Oct 27 12:53 a
-r-sr-s--t 1 owner1 grp 0 Oct 27 12:53 b
drwx------ 2 owner2 grp 68 Oct 27 12:53 c

So, what don't I understand here?? (Sorry, it didn't format that stuff very well.)

I think it's important to make a distinction between a bug (something works differently from how it was intended due to eg. an error during programming), and a design decision that people may disagree with.


Many years ago, my employer had a good relationship with IBM, which supplied its mainframes. This included an inside track on reporting, and getting fixes for, important bugs. The point you raised came up more than once. And IBM finally agreed to accept "design defect" as a legitimate bug!

Nov 28, 2008 6:30 PM in response to frazzlejazz

The default archive for ditto is CPIO, which does preserve the ownerships.

Using the PKZIP option (which seems to be what the Finder uses) does not, but it is difficult to track down whether or not a regular .zip archive is supposed to preserve the ownership. The owner/group seems to have been added a while back, but the documentation on what the default actions are for PKZIP is hard to nail down. Zipinfo shows some additional flags in there, but doesn't describe what they are, so your guess is as good as mine (OK, it's probably a lot better).

Nov 30, 2008 10:40 AM in response to frazzlejazz

Actually, I was referring specifically to the expansion of "Finder" archives (PKZip archives) in Leopard when I said ' ditto' doesn't preserve ownership. I tried to include either "archive" or "expand" whenever mentioning the problem but in case I got sloppy at some point, sorry for the confusion.

And with respect to other types of archives, I did mention that those created by drag-and-drop with "ArchiveUtility.app" (compressed CPIO) could be correctly expanded using ' ditto'. Straight folder-to-folder copies (like the output you just posted, if I'm reading it correctly) never really came up in the context of this thread, but they work correctly (I suspect if they didn't, that would have been noticed much more quickly by somebody by now).

So, yes, it is specifically this form of the command that fails to restore ownership on expanded archives in Leopard, when run as "root" in 10.5:<pre>
ditto -x -k /path/to/archive.zip /path/to/destination</pre>

The actual bug might not be in ' ditto' itself though, since a copy of the 10.4 version of ' ditto' fails in the same way when run on a 10.5 system...

Jan 17, 2009 2:32 PM in response to frazzlejazz

Thanks for the update.

Incidentally, "Finder" and ' ditto' also seem to share a peculiarity in the handling of a certain ACL rule (I forget which off hand) during copying, behaving differently compared to other tools like ' cp'.

The two issues may or may not be related, but the whole area could probably use a big overhaul bug fix - hopefully we'll get one while still in 10.5...

Problem with Finder's "Compress"

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.