--- queue-repair.py 2012-02-26 15:18:47.000000000 +0100 +++ queue-repair.py3 2012-02-26 15:02:12.000000000 +0100 @@ -66,24 +66,24 @@ # key: pathname - all paths are relative to conf-qmail # data: (user, group, mode, split) # split is: 0 : no, 1 : yes, -1 : only with big-todo - 'queue' : ('qmailq', 'qmail', 0750, 0), - 'queue/bounce' : ('qmails', 'qmail', 0700, 0), - 'queue/info' : ('qmails', 'qmail', 0700, 1), - 'queue/intd' : ('qmailq', 'qmail', 0700, -1), - 'queue/local' : ('qmails', 'qmail', 0700, 1), - 'queue/lock' : ('qmailq', 'qmail', 0750, 0), - 'queue/mess' : ('qmailq', 'qmail', 0750, 1), - 'queue/pid' : ('qmailq', 'qmail', 0700, 0), - 'queue/remote' : ('qmails', 'qmail', 0700, 1), - 'queue/todo' : ('qmailq', 'qmail', 0750, -1), + 'queue' : ('qmailq', 'qmail', 0o750, 0), + 'queue/bounce' : ('qmails', 'qmail', 0o070, 0), + 'queue/info' : ('qmails', 'qmail', 0o070, 1), + 'queue/intd' : ('qmailq', 'qmail', 0o070, -1), + 'queue/local' : ('qmails', 'qmail', 0o070, 1), + 'queue/lock' : ('qmailq', 'qmail', 0o750, 0), + 'queue/mess' : ('qmailq', 'qmail', 0o750, 1), + 'queue/pid' : ('qmailq', 'qmail', 0o070, 0), + 'queue/remote' : ('qmails', 'qmail', 0o070, 1), + 'queue/todo' : ('qmailq', 'qmail', 0o750, -1), } nondirs = { # Files to check; format is: # key: pathname - all paths are relative to conf-qmail # data: (user, group, mode) - 'queue/lock/sendmutex' : ('qmails', 'qmail', 0600), - 'queue/lock/tcpto' : ('qmailr', 'qmail', 0644), + 'queue/lock/sendmutex' : ('qmails', 'qmail', 0o600), + 'queue/lock/tcpto' : ('qmailr', 'qmail', 0o644), } @@ -105,7 +105,7 @@ while i <= max: for p in primelist: if (i % p == 0) or (p * p > i): break - if (i % p <> 0): + if (i % p != 0): primelist.append(i) if i >= min: result.append(i) @@ -223,7 +223,7 @@ msg(' fixed, %s ownership %i:%i' % (path, s[ST_UID], s[ST_GID])) else: msg(' testmode, not fixing') - except OSError, o: + except OSError as o: err(o or '[no error message]') checked_owner[path] = None @@ -247,7 +247,7 @@ msg(' changed %s mode to %o' % (path, newmode)) else: msg(' testmode, not fixing') - except OSError, o: + except OSError as o: err(o or '[no error message]') checked_mode[path] = None @@ -467,7 +467,7 @@ if not os.path.exists(path) and not testmode: os.mkfifo(path) chown(path, user, group) - chmod(path, 0622) + chmod(path, 0o622) ####################################### def check_messages(path, split): @@ -549,9 +549,9 @@ # Nothing in these directories to check at this point continue elif path in ('queue/mess', 'queue/todo'): - mode = 0644 + mode = 0o644 else: - mode = 0600 + mode = 0o600 this_split = is_splitdir(is_split, bigtodo) if this_split: splits = range(split) @@ -747,7 +747,7 @@ if force_split < 1: raise ValueError except ValueError: - raise getopt.error, 'split value must be a positive integer (%s)' % value + raise getopt.error('split value must be a positive integer (%s)' % value) elif option in ('-n', '--no-bigtodo'): force_bigtodo = -1 elif option in ('-b', '--bigtodo'): @@ -765,10 +765,10 @@ create = 1 if args: if len(args) > 1: - raise getopt.error, 'conf-qmail must be a single argument (%s)' % string.join(args) + raise getopt.error ('conf-qmail must be a single argument (%s)' % string.join(args)) qmaildir = args[0] - except getopt.error, o: + except getopt.error as o: err('Error: %s' % o, showhelp=1) check_queue(qmaildir, test, force_split, force_bigtodo, create, mathishard)