[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-23 08:47:39 CEST

Daniel Rall <dlr@finemaltcoding.com> writes:

> On Thu, 20 Oct 2005, Kalle Olavi Niemitalo wrote:
>> 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?

According to perldoc -f exec, it uses "/bin/sh -c" on Unix.
That is not user-specific, but neither is it always Bash.

> Can the envelop sender address even contain multibyte characters?

Apparently not at the SMTP level, according to the definitions of
"Reverse-path" in RFC 2821 and "qcontent" in RFC 2822. The MIME
encodings of RFC 2047 do not seem to be allowed there, either.

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

Note that the arguments here will not be parsed by a shell, so
e.g. spaces in $command will be taken as part of the file name,
and quotes in $userlist will not protect spaces (so it would be
better to use @email_addresses directly).

And I wonder what would happen on Windows, where the command line
is a single string rather than a list of strings, and programs
rarely document how their arguments should be quoted.

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

It works in Perl 5.7.1 and later, according to perl571delta:

# o The list form of "open" is now implemented for pipes
# (at least on UNIX):
# open($fh,"-│", ’cat’, ’/etc/motd’)
# creates a pipe, and runs the equivalent of exec(’cat’,
# ’/etc/motd’) in the child process.

The $] test at the beginning of commit-email.pl.in tries to
support versions older than 5.6, too.

  • application/pgp-signature attachment: stored
Received on Sun Oct 23 08:41:32 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.