Skip Menu |
 

This queue is for tickets about the MailTools CPAN distribution.

Report information
The Basics
Id: 89802
Status: resolved
Priority: 0/
Queue: MailTools

People
Owner: Nobody in particular
Requestors: user42 [...] zip.com.au
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Mail::Cap on \\
Date: Mon, 28 Oct 2013 10:32:07 +1100
To: bug-mailtools [...] rt.cpan.org
From: Kevin Ryde <user42 [...] zip.com.au>
Download (untitled) / with headers
text/plain 945b
I believe mailcap files can contain \\ to mean a literal backslash, but Mail::Cap does not undo that backslash when it runs or returns a command. For example foo.pl below run on the sample mailcap file below prints echo \\" sh: 1: Syntax error: Unterminated quoted string where I expected echo \" " I think RFC 1524 is to be read as "qchar" backslash escaping any char, in particular \\ to escape a backslash. There's an example \\ in the draft amended appendix B of http://www.ietf.org/archive/id/draft-borenstein-mailcap-00.ps though as far as I know that draft was not formally adopted. I struck this with Debian zgv which had a complicated test using a regexp on the name of the tty, test=expr "`/usr/bin/tty`" : '/dev/\\(tty\\|vc/\\)[0-9][0-9]*' >/dev/null 2>&1 || expr "$STY" : '[0-9][0-9]*\\.tty[0-9][0-9]*\\.'`hostname`'$' >/dev/null 2>&1 This test passes the debian run-mailcap, but does not pass Mail::Cap.
Download foo.pl
text/x-perl 123b

Message body is not shown because sender requested not to inline it.

Download mailcap
text/plain 21b

Message body is not shown because sender requested not to inline it.

Subject: Re: [rt.cpan.org #89802] Mail::Cap on \\
Date: Mon, 28 Oct 2013 09:46:35 +0100
To: Kevin Ryde via RT <bug-MailTools [...] rt.cpan.org>
From: Mark Overmeer <solutions [...] overmeer.net>
Download (untitled) / with headers
text/plain 917b
* Kevin Ryde via RT (bug-MailTools@rt.cpan.org) [131027 23:34]: Show quoted text
> Sun Oct 27 19:34:31 2013: Request 89802 was acted upon. > Transaction: Ticket created by user42@zip.com.au > Queue: MailTools > Subject: Mail::Cap on \\ > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=89802 > > > > I believe mailcap files can contain \\ to mean a literal backslash, but > Mail::Cap does not undo that backslash when it runs or returns a > command.
I think that the change is minor. At the same time, I cleaned-up the parser a bit more. Can you test the attached? -- Thanks for the report, MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
Download Cap.pm
text/x-perl 6.1k

Message body is not shown because sender requested not to inline it.

Subject: Re: [rt.cpan.org #89802] Mail::Cap on \\
Date: Tue, 29 Oct 2013 09:43:31 +1100
To: bug-MailTools [...] rt.cpan.org
From: Kevin Ryde <user42 [...] zip.com.au>
Download (untitled) / with headers
text/plain 601b
"Mark Overmeer via RT" <bug-MailTools@rt.cpan.org> writes: Show quoted text
> > Can you test the attached?
I think the unbackslashing should be on the $view too. For both the $view and the options fields perhaps a subst like s/\\(.)/$1/g instead of \\ and \; crunched separately. Or even do the ; -> \0 and the unbackslashing together (untested :-). s{;|\\(.)}{defined $1 ? $1 : "\0"}ge; split /\0/; ... A single pass like this might more closely match the way the RFC expresses the quoting. It may also be an easy way to handle the slightly unlikely case of an even number of backslashes before a ;
fixed 2.13


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.