johan...@sun.com wrote:
>> The code in recv() is changing permissions on the temporary files, not 
>> the final files that are in place.
> 
> The permissions are not changed when a rename occurs.  I'm calling chmod
> on the tempfile, but when the rename occurs the new files will have 644
> mode.
> 
> This is why I asked if it made sense to set the mode on your tempfiles
> and then just rename them.  If you're trying to repair files with
> incorrect permissions, it might make sense to break that into a separate
> step.  I.e. set the mode for the tempfiles before the rename, and then
> have a repair routine that you run in the few cases where users/depots
> have leftover bad permissions.  Assuming that the software performing
> the chmod has the permissions to do so, of course.

That's essentially what I've ended up doing.  I've left the call to 
__set_perms for the __init and save_attrs case which all happens once 
generally during load.  I've changed the cases where we do the tempfiles 
to chmod them before the rename; thanks for pointing out the race case 
earlier.

-- 
Shawn Walker
_______________________________________________
pkg-discuss mailing list
pkg-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss

Reply via email to