mailman/mailman.patch

Tue, 29 Mar 2011 20:04:34 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 29 Mar 2011 20:04:34 +0200
changeset 334
4a34d7a82eab
child 371
3d7d8c68b2fc
permissions
-rw-r--r--

Rework package yet again, correcting and introducing new buildconf logic:
Conditionally disable bootstrap stage comparison correctly, correct
english grammar, better find system as(1) and ld(1), indotruce detailed
optimization option messages, more completely guess cpu types, allow
profiled bootstrapping without a preinstalled GCC because many other
compilers have long since implemented 64-bit arithmetic, instruct make
to build sequentially (not in sparallel) when building a profiled
bootstrap as GCC online documents recommend, and generally improve
comment blocks.

The single most important correction in this changeset relates to the
GCC changed optimization policy since at least GCC 4.5, in which -march
is always passed and not always correctly guessed. In the case of this
package, allowing GCC to guess the architecture leads to wild build
errors at various subcomponents (zlib, libgcc, libiberty...) and
bootstrap stages. It seems quite platform specific, and the safest
approach to correcting this seems to be explicitly always specifying the
-march argument when bootstrapping GCC. Because the best choice 'native'
is not available when bootstrapping using a foreign (non GCC) compiler,
a guess is made according to rpmmacros l_platform in that case.

It is questionable as to whether these recent optimization changes
on the part of GCC or this package are compatible with each other,
or if either are complete or correct at all. At least applying these
corrections allows this package to build again in most cases test.

     1 Index: Mailman/Archiver/pipermail.py
     2 --- Mailman/Archiver/pipermail.py.orig	2008-06-30 18:29:46 +0200
     3 +++ Mailman/Archiver/pipermail.py	2008-07-01 20:48:10 +0200
     4 @@ -122,9 +122,9 @@
     5          parentID = article.parentID
     6          if parentID is not None and self.articleIndex.has_key(parentID):
     7              parent = self.getArticle(archive, parentID)
     8 -            myThreadKey = parent.threadKey + article.date + '-'
     9 +            myThreadKey = parent.threadKey + article.date + '/' + article.msgid + '-'
    10          else:
    11 -            myThreadKey = article.date + '-'
    12 +            myThreadKey = article.date + '/' + article.msgid + '-'
    13          article.threadKey = myThreadKey
    14          key = myThreadKey, article.msgid
    15          self.setThreadKey(archive, key, article.msgid)
    16 @@ -418,7 +418,7 @@
    17                  else:
    18                      parent = self.database.getArticle(self.archive,
    19                                                      article.parentID)
    20 -                    article.threadKey = parent.threadKey+article.date+'-'
    21 +                    article.threadKey = parent.threadKey + article.date + '/' + article.msgid + '-'
    22                  self.database.setThreadKey(self.archive,
    23                      (article.threadKey, article.msgid),
    24                      msgid)
    25 @@ -632,9 +632,9 @@
    26              article.parentID = parentID = self.get_parent_info(arch, article)
    27              if parentID:
    28                  parent = self.database.getArticle(arch, parentID)
    29 -                article.threadKey = parent.threadKey + article.date + '-'
    30 +                article.threadKey = parent.threadKey + article.date + '/' + article.msgid + '-'
    31              else:
    32 -                article.threadKey = article.date + '-'
    33 +                article.threadKey = article.date + '/' + article.msgid + '-'
    34              key = article.threadKey, article.msgid
    36              self.database.setThreadKey(arch, key, article.msgid)
    37 Index: Mailman/Commands/cmd_subscribe.py
    38 --- Mailman/Commands/cmd_subscribe.py.orig	2008-06-30 18:29:46 +0200
    39 +++ Mailman/Commands/cmd_subscribe.py	2008-07-01 20:48:10 +0200
    40 @@ -84,6 +84,7 @@
    41      if password is None:
    42          password = Utils.MakeRandomPassword()
    43      if address is None:
    44 +        h = None
    45          realname, address = parseaddr(res.msg['from'])
    46          if not address:
    47              # Fall back to the sender address
    48 Index: Mailman/HTMLFormatter.py
    49 --- Mailman/HTMLFormatter.py.orig	2008-06-30 18:29:46 +0200
    50 +++ Mailman/HTMLFormatter.py	2008-07-01 20:48:10 +0200
    51 @@ -44,7 +44,7 @@
    52          realname = self.real_name
    53          hostname = self.host_name
    54          listinfo_link  = Link(self.GetScriptURL('listinfo'), realname).Format()
    55 -        owner_link = Link('mailto:' + self.GetOwnerEmail(), ownertext).Format()
    56 +        owner_link = Link('mailto:' + self.GetOwnerEmail(), realname + '-owner').Format()
    57          innertext = _('%(listinfo_link)s list run by %(owner_link)s')
    58          return Container(
    59              '<hr>',
    60 Index: Mailman/Handlers/Decorate.py
    61 --- Mailman/Handlers/Decorate.py.orig	2008-06-30 18:29:46 +0200
    62 +++ Mailman/Handlers/Decorate.py	2008-07-01 20:48:10 +0200
    63 @@ -197,6 +197,7 @@
    64      del msg['content-transfer-encoding']
    65      del msg['content-disposition']
    66      msg['Content-Type'] = 'multipart/mixed'
    67 +    msg['Mime-version'] = '1.0'
    71 Index: Mailman/Handlers/Scrubber.py
    72 --- Mailman/Handlers/Scrubber.py.orig	2008-06-30 18:29:46 +0200
    73 +++ Mailman/Handlers/Scrubber.py	2008-07-01 20:48:10 +0200
    74 @@ -385,6 +385,8 @@
    75                      t = unicode(t, 'ascii', 'replace')
    76                  try:
    77                      # Should use HTML-Escape, or try generalizing to UTF-8
    78 +                    if len(charset) == 0:
    79 +                        charset = 'us-ascii'
    80                      t = t.encode(charset, 'replace')
    81                  except (UnicodeError, LookupError, ValueError,
    82                          AssertionError):
    83 Index: Mailman/Queue/OutgoingRunner.py
    84 --- Mailman/Queue/OutgoingRunner.py.orig	2008-06-30 18:29:46 +0200
    85 +++ Mailman/Queue/OutgoingRunner.py	2008-07-01 20:48:10 +0200
    86 @@ -89,6 +89,7 @@
    87                  syslog('error', 'Cannot connect to SMTP server %s on port %s',
    88                         mm_cfg.SMTPHOST, port)
    89                  self.__logged = True
    90 +            self._snooze(0)
    91              return True
    92          except Errors.SomeRecipientsFailed, e:
    93              # Handle local rejects of probe messages differently.
    94 Index: Mailman/htmlformat.py
    95 --- Mailman/htmlformat.py.orig	2008-06-30 18:29:46 +0200
    96 +++ Mailman/htmlformat.py	2008-07-01 20:48:10 +0200
    97 @@ -300,7 +300,8 @@
    98          charset = 'us-ascii'
    99          if self.language:
   100              charset = Utils.GetCharSet(self.language)
   101 -        output = ['Content-Type: text/html; charset=%s\n' % charset]
   102 +        output = ['Content-Type: text/html; charset=%s' % charset]
   103 +        output.append('Cache-control: no-cache\n')
   104          if not self.suppress_head:
   105              kws.setdefault('bgcolor', self.bgcolor)
   106              tab = ' ' * indent
   107 Index: bin/check_perms
   108 --- bin/check_perms.orig	2008-06-30 18:29:46 +0200
   109 +++ bin/check_perms	2008-07-01 20:48:10 +0200
   110 @@ -82,7 +82,7 @@
   111      return os.stat(path)[ST_MODE]
   113  def statgidmode(path):
   114 -    stat = os.stat(path)
   115 +    stat = os.lstat(path)
   116      return stat[ST_MODE], stat[ST_GID]
   118  seen = {}
   119 Index: bin/config_list
   120 --- bin/config_list.orig	2008-06-30 18:29:46 +0200
   121 +++ bin/config_list	2008-07-01 20:48:10 +0200
   122 @@ -307,6 +307,11 @@
   123                                      in mm_cfg.OPTINFO.items()
   124                                      if validval & bitval]
   125                      gui._setValue(mlist, k, validval, fakedoc)
   126 +                    # Ugly hack, but seems to be needed since
   127 +                    # new_member_options isn't really a number in gui.
   128 +                    # -- tfheen, 2003-12-06
   129 +                    if k == "new_member_options":
   130 +                        mlist.new_member_options = validval
   131              # BAW: when to do gui._postValidate()???
   132      finally:
   133          if savelist and not checkonly:
   134 Index: bin/mailmanctl
   135 --- bin/mailmanctl.orig	2008-06-30 18:29:46 +0200
   136 +++ bin/mailmanctl	2008-07-01 20:48:10 +0200
   137 @@ -417,6 +417,13 @@
   138          # won't be opening any terminal devices, don't do the ultra-paranoid
   139          # suggestion of doing a second fork after the setsid() call.
   140          os.setsid()
   141 +
   142 +        # Be sure to close any open std{in,out,err}
   143 +        devnull = os.open('/dev/null', 0)
   144 +        os.dup2(devnull, 0)
   145 +        os.dup2(devnull, 1)
   146 +        os.dup2(devnull, 2)
   147 +
   148          # Instead of cd'ing to root, cd to the Mailman installation home
   149          os.chdir(mm_cfg.PREFIX)
   150          # Set our file mode creation umask
   151 Index: bin/newlist
   152 --- bin/newlist.orig	2008-06-30 18:29:46 +0200
   153 +++ bin/newlist	2008-07-01 20:48:10 +0200
   154 @@ -87,6 +87,9 @@
   155  defined in your Defaults.py file or overridden by settings in mm_cfg.py).
   157  Note that listnames are forced to lowercase.
   158 +
   159 +The list admin address need to be a fully-qualified address, like
   160 +owner@example.com, not just owner.
   161  """
   163  import sys
   164 @@ -94,6 +97,7 @@
   165  import getpass
   166  import getopt
   167  import sha
   168 +import grp
   170  import paths
   171  from Mailman import mm_cfg
   172 @@ -122,6 +126,9 @@
   175  def main():
   176 +    gid = grp.getgrnam(mm_cfg.MAILMAN_GROUP)[2]
   177 +    if os.getgid() != mm_cfg.MAILMAN_GROUP:
   178 +        os.setgid(gid)
   179      try:
   180          opts, args = getopt.getopt(sys.argv[1:], 'hql:u:e:',
   181                                     ['help', 'quiet', 'language=',
   182 @@ -203,7 +210,7 @@
   183          except Errors.BadListNameError, s:
   184              usage(1, _('Illegal list name: %(s)s'))
   185          except Errors.EmailAddressError, s:
   186 -            usage(1, _('Bad owner email address: %(s)s'))
   187 +            usage(1, _('Bad owner email address: %(s)s.  Owner addresses need to be fully-qualified names, like "owner@example.com", not just "owner".'))
   188          except Errors.MMListAlreadyExistsError:
   189              usage(1, _('List already exists: %(listname)s'))
   191 Index: bin/update
   192 --- bin/update.orig	2008-06-30 18:29:46 +0200
   193 +++ bin/update	2008-07-01 20:48:10 +0200
   194 @@ -552,9 +552,11 @@
   195      file20 = os.path.join(mm_cfg.DATA_DIR, 'pending_subscriptions.db')
   196      file214 = os.path.join(mm_cfg.DATA_DIR, 'pending.pck')
   197      db = None
   198 +    ver = None
   199      # Try to load the Mailman 2.0 file
   200      try:
   201          fp = open(file20)
   202 +        ver = "20"
   203      except IOError, e:
   204          if e.errno <> errno.ENOENT: raise
   205      else:
   206 @@ -566,6 +568,7 @@
   207          # Try to load the Mailman 2.1.x where x < 5, file
   208          try:
   209              fp = open(file214)
   210 +            ver = "214"
   211          except IOError, e:
   212              if e.errno <> errno.ENOENT: raise
   213          else:
   214 @@ -599,8 +602,12 @@
   215              # data[0] is the address being unsubscribed
   216              addrops_by_address.setdefault(data[0], []).append((key, val))
   217          elif op == Pending.SUBSCRIPTION:
   218 -            # data[0] is a UserDesc object
   219 -            addr = data[0].address
   220 +            if ver == "20":
   221 +                # data is tuple (emailaddr, password, digest)
   222 +                addr = data[0]
   223 +            else:
   224 +                # data[0] is a UserDesc object
   225 +                addr = data[0].address
   226              subs_by_address.setdefault(addr, []).append((key, val))
   227          elif op == Pending.RE_ENABLE:
   228              # data[0] is the mailing list's internal name
   229 Index: scripts/driver
   230 --- scripts/driver.orig	2008-06-30 18:29:46 +0200
   231 +++ scripts/driver	2008-07-01 20:48:10 +0200
   232 @@ -95,6 +95,15 @@
   233          module = getattr(pkg, scriptname)
   234          main = getattr(module, 'main')
   235          try:
   236 +            import os
   237 +            request_method = os.environ.get('REQUEST_METHOD')
   238 +            if not request_method in ['GET', 'POST', 'HEAD']:
   239 +                print "Status: 405 Method not allowed"
   240 +                print "Content-type: text/plain"
   241 +                print
   242 +                print "The method is not allowed"
   243 +                sys.exit()
   244 +                
   245              try:
   246                  sys.stderr = logger
   247                  sys.stdout = tempstdout

mercurial