Skip to content

Commit 4f81514

Browse files
author
Richard Jones
committed
umask is now configurable (with the same 0002 default)
1 parent 880fa90 commit 4f81514

File tree

8 files changed

+26
-16
lines changed

8 files changed

+26
-16
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Fixed:
1818
- dangling connections in session handling (sf bug 1463359)
1919
- reduced frequency of session timestamp update
2020
- classhelp popup pagination forgot about "type" (sf bug 1465836)
21+
- umask is now configurable (with the same 0002 default)
2122

2223

2324
2006-03-03 1.1.1

roundup/backends/back_anydbm.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
#$Id: back_anydbm.py,v 1.198 2006-04-27 01:39:47 richard Exp $
18+
#$Id: back_anydbm.py,v 1.199 2006-04-27 04:59:37 richard Exp $
1919
'''This module defines a backend that saves the hyperdatabase in a
2020
database chosen by anydbm. It is guaranteed to always be available in python
2121
versions >2.1.1 (the dumbdbm fallback in 2.1.1 and earlier has several
@@ -96,8 +96,7 @@ def __init__(self, config, journaltag=None):
9696
self.transactions = []
9797
self.indexer = Indexer(self)
9898
self.security = security.Security(self)
99-
# ensure files are group readable and writable
100-
os.umask(0002)
99+
os.umask(config.UMASK)
101100

102101
# lock it
103102
lockfilenm = os.path.join(self.dir, 'lock')

roundup/backends/back_metakit.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: back_metakit.py,v 1.107 2006-04-27 01:39:47 richard Exp $
1+
# $Id: back_metakit.py,v 1.108 2006-04-27 04:59:37 richard Exp $
22
'''Metakit backend for Roundup, originally by Gordon McMillan.
33
44
Known Current Bugs:
@@ -100,7 +100,7 @@ def __init__(self, config, journaltag=None):
100100
self.stats = {'cache_hits': 0, 'cache_misses': 0, 'get_items': 0,
101101
'filtering': 0}
102102

103-
os.umask(0002)
103+
os.umask(config.UMASK)
104104

105105
def post_init(self):
106106
if self.indexer.should_reindex():

roundup/backends/back_sqlite.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: back_sqlite.py,v 1.43 2005-06-08 03:41:21 anthonybaxter Exp $
1+
# $Id: back_sqlite.py,v 1.44 2006-04-27 04:59:37 richard Exp $
22
'''Implements a backend for SQLite.
33
44
See https://pysqlite.sourceforge.net/ for pysqlite info
@@ -94,7 +94,7 @@ def sql_open_connection(self):
9494

9595
def open_connection(self):
9696
# ensure files are group readable and writable
97-
os.umask(0002)
97+
os.umask(self.config.UMASK)
9898

9999
(self.conn, self.cursor) = self.sql_open_connection()
100100

roundup/backends/sessions_dbm.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#$Id: sessions_dbm.py,v 1.6 2006-04-27 04:03:11 richard Exp $
1+
#$Id: sessions_dbm.py,v 1.7 2006-04-27 04:59:37 richard Exp $
22
"""This module defines a very basic store that's used by the CGI interface
33
to store session and one-time-key information.
44
@@ -19,8 +19,7 @@ class BasicDatabase:
1919
def __init__(self, db):
2020
self.config = db.config
2121
self.dir = db.config.DATABASE
22-
# ensure files are group readable and writable
23-
os.umask(0002)
22+
os.umask(db.config.UMASK)
2423

2524
def exists(self, infoid):
2625
db = self.opendb('c')

roundup/configuration.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Roundup Issue Tracker configuration support
22
#
3-
# $Id: configuration.py,v 1.33 2006-02-08 03:47:28 richard Exp $
3+
# $Id: configuration.py,v 1.34 2006-04-27 04:59:37 richard Exp $
44
#
55
__docformat__ = "restructuredtext"
66

@@ -353,6 +353,19 @@ def str2value(self, value):
353353
except ValueError:
354354
raise OptionValueError(self, value, "Integer number required")
355355

356+
class OctalNumberOption(Option):
357+
358+
"""Octal Integer numbers"""
359+
360+
def str2value(self, value):
361+
try:
362+
return int(value, 8)
363+
except ValueError:
364+
raise OptionValueError(self, value, "Octal Integer number required")
365+
366+
def _value2str(self, value):
367+
return oct(value)
368+
356369
class NullableOption(Option):
357370

358371
"""Option that is set to None if it's string value is one of NULL strings
@@ -466,6 +479,8 @@ class NullableFilePathOption(NullableOption, FilePathOption):
466479
"Additional stop-words for the full-text indexer specific to\n"
467480
"your tracker. See the indexer source for the default list of\n"
468481
"stop-words (eg. A,AND,ARE,AS,AT,BE,BUT,BY, ...)"),
482+
(OctalNumberOption, "umask", "02",
483+
"Defines the file creation mode mask."),
469484
)),
470485
("tracker", (
471486
(Option, "name", "Roundup issue tracker",

roundup/scripts/roundup_server.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
"""Command-line script that runs a server over roundup.cgi.client.
1919
20-
$Id: roundup_server.py,v 1.82 2006-02-22 05:40:56 a1s Exp $
20+
$Id: roundup_server.py,v 1.83 2006-04-27 04:59:37 richard Exp $
2121
"""
2222
__docformat__ = 'restructuredtext'
2323

@@ -657,7 +657,6 @@ def daemonize(pidfile):
657657
os._exit(0)
658658

659659
os.chdir("/")
660-
os.umask(0)
661660

662661
# close off std(in|out|err), redirect to devnull so the file
663662
# descriptors can't be used again

scripts/imapServer.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,6 @@ def makeDaemon(self):
263263
pidfile.close()
264264
os._exit(0)
265265

266-
#os.chdir("/")
267-
#os.umask(0)
268-
269266
def run(self):
270267
"""Run email gathering daemon.
271268

0 commit comments

Comments
 (0)