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

Re: svn commit: r16801 - trunk/tools/hook-scripts

From: Kalle Olavi Niemitalo <kon_at_iki.fi>
Date: 2005-10-20 09:39:56 CEST

dlr@tigris.org writes:

> Modified: trunk/tools/hook-scripts/commit-email.pl.in

> @@ -463,7 +464,7 @@
> if ($sendmail =~ /\w/ and @email_addresses)
> {
> # Open a pipe to sendmail.
> - my $command = "$sendmail -f$mail_from $userlist";
> + my $command = "$sendmail -f'$mail_from' $userlist";
> if (open(SENDMAIL, "| $command"))
> {
> print SENDMAIL @head, @body;

I wonder if it would be better to use

  my $command = "$sendmail -f\Q$mail_from\E $userlist";

in case there are single quotes in $mail_from, as well.

This does the wrong thing with newlines (at least some shells
remove backslash-newline pairs entirely, rather than leave the
newline), but if you have those, the generated "From:" header
probably won't be right either.

Also, if $mail_from contains multibyte characters, then \Q seems
to quote each byte if Perl doesn't know the character encoding;
but at least Bash 3.0 happily removes the backslashes again.

Another possibility might be to put the strings as separate
arguments in the open call:

  if open(SENDMAIL, "|-", $command, "-f", $mail_from,
          split(/\s+/, $userlist))

but perhaps that doesn't work on all Perl versions you want to

  • application/pgp-signature attachment: stored
Received on Thu Oct 20 09:35:36 2005

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

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