PDA

View Full Version : Cocoa/Carbon applications and umask


Cadre
03-25-2002, 09:43 PM
How does one get Cocoa and Carbon applications to respect the umask when creating files? (I've yet to find a Carbon or Cocoa application that respects my umask of 077) Do they have to do it themselves? Why isn't this handled by the file manipulation libraries themselves or am I missing something?

mervTormel
03-26-2002, 04:46 AM
your missing that the shell environment notion of permissions mask (umask) is unknown to GUI apps. that is, aqua apps don't run your shell startup scripts, right?

it looks to me like aqua apps save with a perm mask of 022. there might be a way for a file to inherit its parent directory's perms. i'll look into it.

Cadre
03-26-2002, 10:22 AM
your missing that the shell environment notion of permissions mask (umask) is unknown to GUI apps. that is, aqua apps don't run your shell startup scripts, right?
Hmm, interesting point. Makes sense if one is starting applications via the Finder. I generally start applications (via /usr/bin/open) and I assumed applications would inherit the mask.

mervTormel
03-26-2002, 10:58 AM
% man 1 open
...
The open command opens a file (or a directory), just as if you had double-clicked the file's icon.
...

i could get no aqua apps to "pay attention" to parent directory perm signatures for new file creation. all files are saved as perm 644, u=rw,go=r

there is a facility to create environment variables for aqua apps. the following file creates two application environment variables for all aqua apps...

$ cat .MacOSX/environment.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
<plist version="0.9">
<dict>
<key>aevFooVar</key>
<string>foo</string>
<key>aevTestVar</key>
<string>test</string>
</dict>
</plist>

it is unclear to me how they are referenced in apps, and doesn't look like it would facilitate any app umask granularity.