barneygale / mark2

minecraft server wrapper, written in python with twisted
Other
105 stars 27 forks source link

Umask not preserved for java process #58

Closed runfalk closed 11 years ago

runfalk commented 11 years ago

When logging in and out from my server the permissions for the dat files in world/players/ gets odd permissions. My user's umask is 0022, but the files become like this:

-rw------- 1 mark2 mark2 1923 Apr 20 01:28 world/players/JamesBanana.dat

When I print the umask inside _process.py:Process.serverstart like this:

def server_start(self, e=None):
    import os
    self.parent.console("starting minecraft server umask %o" % os.umask(0022))

It prints 077, without the leading zero, meaning it somehow looses the umask along the way. This is problematic as I need all the files to be world readable.

edk0 commented 11 years ago

This appears to be a limitation of twistd. If a umask is not explicitly requested, it defaults to setting it to 077. If I can't think of something better, I'll have the launcher get the current umask and supply it as an option to twistd.

edk0 commented 11 years ago

let me know if 43adb0d fixes your issue.

runfalk commented 11 years ago

I forgot to mention, setting the umask to 022 like I do in server_start does "fall through" to twistd i.e. it respects that umask setting. I don't know if server_start is being called from within twistd though. I would be happy with either it respecting my umask or me being able to specify it in the properties file, or maybe both.

runfalk commented 11 years ago

I missed your latest reply. The fix works splendidly. Thank you very much!