devops-csmake / csmake-providers

Providerrs (inputs/outputs) for csmake
GNU General Public License v3.0
0 stars 1 forks source link

If permissions change on files CsmakeServiceProvider is tracking, the permissions are overwritten by the old permissions before the change #2

Open autumnpat opened 7 years ago

autumnpat commented 7 years ago

PypiFacade and other file tracking faux services implemented by CsmakeServiceProvider track permissions of files that it seeks to change...if the permissions are changed by a secondary actor while the facade is active and has gained ownership of a file, then the service will incorrectly restore the old permissions.

Three things need to happen:

  1. We should tighten the contention window for permissions to be for only the times when CsmakeServiceProvider needs to make a change to a monitored file....this is hard because this means that every time ensure is run, the permissions will have to be captured and released vs. now when we simply have the files we need captured with the state of the permissions at the time of the capture....this may cause the file tracking and ensuring of faux service state to become less stable and slower.
  2. We need to ensure that external changes to permissions win in contention situations. a) This implies that we must check the "owned" state against the current state before restoring the previous state if owned != current -> abort restore of permissions. b) inotify has an IN_ATTRIB notification that we could handle and track....this may be easier to simply check a list of all the IN_ATTRIB'ed files we encounter.....however, the catch is that we strip tracking for files where we can to free up inotify resources and in scarce inotify instances we have the problem that we may not be tracking some files via inotify.
autumnpat commented 7 years ago

https://github.com/csmake-hpe/csmake/issues/21