[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: hook-script: commit-email.pl

From: Gustavo Delfino <gdelfino_at_umich.edu>
Date: 2007-08-12 18:25:41 CEST

OK, I think I understand the problem and would like to propose a
solution. But first of all, this is how I'm calling the program
inside post-commit:

/usr/local/svn/gds/hooks/commit-email.pl "$REPOS" "$REV" --from "My
Server Name <noreply@mydomain.com>" -s [abcdefg] gdelfino@umich.com
(and other addresses)

In the script itself, the only configuration that I did was in line 56:

my $svnlook = "/usr/local/bin/svnlook";

With this configuration emails are being sent with incorrect headers.

Proposed solution:

Considering that in line 208 we have:

             elsif ($arg eq '--stdout')
               {
                 $current_project->{stdout} = 1;
               }

And in line 715 we have:

sub new_project
{
   return {email_addresses => [],
           from_address => '',
           hostname => '',
           log_file => '',
           match_regex => '.',
           reply_to => '',
           subject_prefix => '',
           show_diff => 1,
           stdout => 0};
}

And that "defined $stdout" is true when $stdout is equal to number 0

Then I propose this change in commit-email.pl:

***************
*** 546,554 ****
         }

       my @head;
       my $formatted_date;
! if (defined $stdout)
         {
           $formatted_date = strftime('%a %b %e %X %Y', localtime());
           push(@head, "From $mail_from $formatted_date\n");
         }
--- 546,554 ----
         }

       my @head;
       my $formatted_date;
! if (defined $stdout && $stdout == 1)
         {
           $formatted_date = strftime('%a %b %e %X %Y', localtime());
           push(@head, "From $mail_from $formatted_date\n");
         }

Agree? Otherwise my notifications are being send screwed up with
double From headers.

Regards,

Gustavo Delfino

On Aug 12, 2007, at 11:59 AM, John Peacock wrote:
> Gustavo Delfino wrote:
>> John, I made that assumption because somehow the message was actually
>> delivered with the incorrect header. I'll continue to do more
>> tests to
>> figure out what went wrong.
>
> You need to describe exactly how you executed the script itself
> (and please keep
> the discussion on the list). In particular, if you passed --stdout
> to the
> script, even if you set $sendmail or $smtp_server, then that takes
> precedence:
>
> # Sendmail path, or SMTP server address.
> # You should define exactly one of these two configuration variables,
> # leaving the other commented out, to select which method of sending
> # email should be used.
> # Using --stdout on the command line overrides both.
> ...
> " --stdout Spit the message in mbox format to stdout.
> \n",
>
> The important clue is that the RFC-2820 "From:" header must contain
> a true
> e-mail address, e.g.:
>
> "John Peacock" <jpeacock@rowman.com>
>
> and must not contain a formatted date field at all. If your
> message had the
> date appended, you called the script erroneously...
>
> John

  • application/pkcs7-signature attachment: smime.p7s
Received on Sun Aug 12 18:25:45 2007

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.