From: david@lang.hm Date: Sun, 16 Sep 2007 20:19:31 GMT Subject: Re: metastore Message-ID: In-Reply-To: <85zlzn812s.fsf@lola.goethe.zz> On Sun, 16 Sep 2007, David Kastrup wrote: > Junio C Hamano writes: > >> Yes, I am very well aware that somebody already mentioned "there >> is a window between the true checkout and permission tweaking". >> If you need to touch the core level in order to close that >> window, I am not interested. > > Doing this atomically involves creating the file in question by > specifying the permissions on the creat system call already, and > possibly wrap seteuid calls and similar around it for getting the > right file/ownership. > > However, it is not really necessary to do this atomically: instead one > can rather create the file using safe permissions (600) at first, then > do fchown and fchmod (or chown/chmod) at some point in time afterwards > as required. the problem with this in /etc is if you do the wrong file as 600 you can cause lots of nasty problems to the system during the window. for some files/directories you will want to write the file to a temp name and then move the file atomicly to the final location. git itself shouldn't need to worry about this, the external write routine I'm talking about is the correct place for this (at least until all the bugs get worked out and everyone is comfortable that everything is good, and doesn't impact the core git code badly) David Lang