Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'CpMac a bad choice' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
CpMac a bad choice
Authored by: gatorparrots on Apr 22, '03 01:26:13PM
I don't know why Gary Kerbaugh decided to use CpMac in his rmm script (the script in question). CpMac is only included in the Developer Tools, a 300+MB download and optional install, so it will not be on every Mac.
% which CpMac 
/Developer/Tools/CpMac
Additionally, CpMac does not preserve permissions:
Utility 	Preserves Permissions? 	Preserves Resource Forks & Creator/Type?
cp 		yes 			no
CpMac 		no 			yes
ditto 		yes 			yes
rsync 		yes 			no
(Chart from: http://www.macdevcenter.com/pub/a/mac/2002/07/02/terminal_5.html)

This may or may not be a problem, especially since the items are destined for deletion anyway. My pedantic nature, however, dictates preserving the file intact until it is actually removed from the filesystem. Therefore, I suggest replacing CpMac in Gary's script with ditto (thus recreating the file exactly, with both permissions and resource fork information intact). Additionally, ditto is part of the default OS X distribution, so it can be counted upon to be on any system upon which this script is deployed.

% which ditto
/usr/bin/ditto


[ Reply to This | # ]
CpMac a bad choice
Authored by: ashill on Apr 22, '03 04:19:37PM
Are you sure that ditto is not installed by the developer tools? I don't know, but being in /usr/bin doesn't necessarily mean it's included in a default install. For example, gcc was installed by the Developer tools (I'm almost certain):

% which gcc
/usr/bin/gcc


[ Reply to This | # ]

CpMac a bad choice
Authored by: coyote on Apr 22, '03 04:47:15PM
Additionally, CpMac does not preserve permissions

It does if you use the '-p' flag:
CpMac -r source target

[ Reply to This | # ]

-p flag
Authored by: gatorparrots on Apr 22, '03 07:49:08PM
The -p flag on CpMac does not mean the same thing as the -p flag on cp. Note the fine difference (from man CpMac):
CpMac - copy files preserving metadata and forks

     -p    Causes CpMac to preserve in the copy as many of the modification
           time, access time, file flags, file mode, user ID, and group ID as
           allowed by permissions.


[ Reply to This | # ]