Re: Rép : [TxMt] mate and file owner

Allan Odgaard throw-away-1 at macromates.com
Fri Nov 3 22:55:46 UTC 2006


On 3. Nov 2006, at 19:13, Une Bévue wrote:

>>> something i didn't understood, suppose i write a wrapper to mate  
>>> "sudo_mate" even launching TextMate like that :
>>>
>>> sudo /Applications/TextMate/TextMate.app/Contents/MacOS/TextMate   
>>> blahblah

As for why this is not a good idea (as you asked in the other letter)  
then it is because you are running TextMate as root, and TextMate  
will run *a lot* of other code, load frameworks, have input manager  
code injected into it, etc. and all that code will run as root.

As for why your wrapper did not work, you need to call ‘mate -w’ to  
have mate wait till TextMate is done writing the file.

> ~/Desktop/sudo_textmate%> ls -al
> -rw-rw-rw-    1 news  admin   122 Nov  3 11:01 essai-sudo-config
>
> i open it with TextMate, add "Hello world !" inside and save it.
>
> TextMate didn't ask in authetification and the file has now those  
> user:group :

It did not ask because you made the file writable by the world, so it  
was allowed to write to the file.

> ~/Desktop/sudo_textmate%> ls -al
> -rw-rw-rw-    1 yvon  yvon   140 Nov  3 18:16 essai-sudo-config
>
> (yvon being my login name)
>
> this should be considered as a bug afaik ?

TextMate shouldn’t really care about these things -- it writes the  
data to the disk, the file system will stamp it with a date, who  
wrote it, etc.

That said, I can’t reproduce your problem.

Could you try write to the file from shell instead -- and while I did  
test it with Atomic Saves enabled in Preferences, try disable that.

> TextMate would have either not open the file or ask for  
> authentification ...

For that, you should not make it writable by the world.




More information about the textmate mailing list