[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: Daniel Rall <dlr_at_finemaltcoding.com>
Date: 2005-10-21 01:12:46 CEST

Your improvement suggestions sound promising.

On Thu, 20 Oct 2005, Kalle Olavi Niemitalo wrote:

> dlr@tigris.org writes:
> > @@ -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.

Why would there be newlines in the envelop sender address?

> 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.

Sounds like an important concern. Does Perl always use bash, or does it
use whichever shell an user has setup? Can the envelop sender address
even contain multibyte characters? (It's part of the SMTP conversation,
rather than an intrinsic part of the message body, yes?)

> 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))
I like the look of this better (I'm unfamiliar with the quoting technique
you used above). $command could be replaced with $sendmail, eliminating
the need for that variable (I'd call it a local variable, but it didn't
look like hardly anything in that script qualified).

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

print "Happy not to be a Perl hacker ;-P\n";
What versions of Perl would this not work on, and should we care?

Thanks, Dan

To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Oct 21 01:11:48 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.