You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Daniel Widenfalk <Da...@iar.se> on 2008/09/08 10:04:53 UTC

Anyone else having problems with empty mails from mailer.py?

Hi all,

I've been struggling for the last couple of weeks with an issue
in the mailer.py script: the mailer kept sending me completely
empty commit-mails!

After the initial hurdle of having to "learn" python I managed
to track down the issue to a "KeyValue" (I think it was) exception
being thrown, when building the subject line of the mail, after the
pipe to sendmail had been opened.

I think the root of the problem is that a group is matched by
the for_repos config, but no files in the commit matches the
for_paths config. The mailer then falls back to the default
settings for subject and receiver. The subject config contained
references to RE-matches (coll and repo) and the exception is
thrown when trying to replace them in the subject line template
but as no file was matched in "which_groups", the params hash was
set to the default value (that obviously did not include the coll
and repo substitutions). (was that description even remotely
understandable?)

Also, the problem only occurred when certain developers commit
to the server. It turned out that these users were connected to
groups that contained ".*" RE-matches for the repository.

The group description triggering this looks like this:

  [ruby-reviewers]
  for_repos = /path-to-repos/(?P<coll>[^/]*)/(?P<repo>.*)
  for_paths = .*\.rb

Has anyone else seen this behavior?

Regards
/Daniel Widenfalk

--------------------------------------------------------------
    Daniel  Widenfalk          IAR Systems AB
Senior Development Engineer    Box 23051  (Islandsgatan 2)
                               S-75023 Uppsala, SWEDEN

Phone: +46 (0)18 167800        WWW:   http://www.iar.se
Fax  : +46 (0)18 167838        EMail: Daniel.Widenfalk@IAR.se
--------------------------------------------------------------

Legal note:

"The information  contained in this message is confidential
 and may be  legally privileged.  It is intended solely for
 the  addressee.  Access to this  message by anyone else is
 unauthorized.  If you are not the intended  recipient, any
 disclosure,  copying or  distribution of this  message, or
 any action or  omission taken by you in reliance on it, is
 prohibited and may be unlawful. Please immediately contact
 the sender if you have received this message in error."




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Anyone else having problems with empty mails from mailer.py?

Posted by Daniel Widenfalk <Da...@iar.se>.
C. Michael Pilato wrote:
> Daniel Widenfalk wrote:
>> Hi all,
>>
>> I've been struggling for the last couple of weeks with an issue
>> in the mailer.py script: the mailer kept sending me completely
>> empty commit-mails!
> 
> We've not seen empty mails here in the Subversion project's own use of
> mailer.py, but we have been plagued by the occasional missing diff (instead
> displaying an error line about a non-existent tempfile) or -- even more
> confusingly -- weird diffs between two totally different files (presumably
> caused by the same tempfile mismanagement we see in the former case).

Ok. I made a quick fix to our mailer.py by making the script
ignore all matches that does not belong to a named group, i.e:

--- mailer.py.old       2007-09-25 17:15:57.000000000 +0200
+++ mailer.py   2008-09-05 17:21:20.000000000 +0200
@@ -352,16 +352,17 @@
     self.groups = { }
     for path, change in self.changelist:
       for (group, params) in self.cfg.which_groups(path):
-        # turn the params into a hashable object and stash it away
-        param_list = params.items()
-        param_list.sort()
-        # collect the set of paths belonging to this group
-        if self.groups.has_key( (group, tuple(param_list)) ):
-          old_param, paths = self.groups[group, tuple(param_list)]
-        else:
-          paths = { }
-        paths[path] = None
-        self.groups[group, tuple(param_list)] = (params, paths)
+        if group is not None:
+          # turn the params into a hashable object and stash it away
+          param_list = params.items()
+          param_list.sort()
+          # collect the set of paths belonging to this group
+          if self.groups.has_key( (group, tuple(param_list)) ):
+            old_param, paths = self.groups[group, tuple(param_list)]
+          else:
+            paths = { }
+          paths[path] = None
+          self.groups[group, tuple(param_list)] = (params, paths)

     # figure out the changed directories
     dirs = { }
@@ -441,10 +442,11 @@
     # collect the set of groups and the unique sets of params for the
options
     self.groups = { }
     for (group, params) in self.cfg.which_groups(''):
-      # turn the params into a hashable object and stash it away
-      param_list = params.items()
-      param_list.sort()
-      self.groups[group, tuple(param_list)] = params
+      if group is not None:
+        # turn the params into a hashable object and stash it away
+        param_list = params.items()
+        param_list.sort()
+        self.groups[group, tuple(param_list)] = params

     self.output.subject = 'r%d - %s' % (repos.rev, propname)

@@ -532,16 +534,17 @@
     self.groups = { }
     for path in self.dirlist:
       for (group, params) in self.cfg.which_groups(path):
-        # turn the params into a hashable object and stash it away
-        param_list = params.items()
-        param_list.sort()
-        # collect the set of paths belonging to this group
-        if self.groups.has_key( (group, tuple(param_list)) ):
-          old_param, paths = self.groups[group, tuple(param_list)]
-        else:
-          paths = { }
-        paths[path] = None
-        self.groups[group, tuple(param_list)] = (params, paths)
+        if group is not None:
+          # turn the params into a hashable object and stash it away
+          param_list = params.items()
+          param_list.sort()
+          # collect the set of paths belonging to this group
+          if self.groups.has_key( (group, tuple(param_list)) ):
+            old_param, paths = self.groups[group, tuple(param_list)]
+          else:
+            paths = { }
+          paths[path] = None
+          self.groups[group, tuple(param_list)] = (params, paths)

     commondir, dirlist = get_commondir(self.dirlist)

----------------------

I'm not sure if this change is too much of a blunt axe or the
proper thing to do.

It could be a good idea to delay opening the pipe to sendmail
until the entire message has been built in a string/list/file
and add an "except all" (??? is there an equivalent to catch(...)
in Python?) to get a proper diagnostic message into the mail.

/D

--------------------------------------------------------------
    Daniel  Widenfalk          IAR Systems AB
Senior Development Engineer    Box 23051  (Islandsgatan 2)
                               S-75023 Uppsala, SWEDEN

Phone: +46 (0)18 167800        WWW:   http://www.iar.se
Fax  : +46 (0)18 167838        EMail: Daniel.Widenfalk@IAR.se
--------------------------------------------------------------

Legal note:

"The information  contained in this message is confidential
 and may be  legally privileged.  It is intended solely for
 the  addressee.  Access to this  message by anyone else is
 unauthorized.  If you are not the intended  recipient, any
 disclosure,  copying or  distribution of this  message, or
 any action or  omission taken by you in reliance on it, is
 prohibited and may be unlawful. Please immediately contact
 the sender if you have received this message in error."




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Anyone else having problems with empty mails from mailer.py?

Posted by "C. Michael Pilato" <cm...@collab.net>.
Daniel Widenfalk wrote:
> Hi all,
> 
> I've been struggling for the last couple of weeks with an issue
> in the mailer.py script: the mailer kept sending me completely
> empty commit-mails!

We've not seen empty mails here in the Subversion project's own use of
mailer.py, but we have been plagued by the occasional missing diff (instead
displaying an error line about a non-existent tempfile) or -- even more
confusingly -- weird diffs between two totally different files (presumably
caused by the same tempfile mismanagement we see in the former case).

-- 
C. Michael Pilato <cm...@collab.net>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand