Bug 211735 - Escape shell special characters when passing %{foo} to command/pipe
Summary: Escape shell special characters when passing %{foo} to command/pipe
Status: RESOLVED INTENTIONAL
Alias: None
Product: kmail
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Mandriva RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-25 02:24 UTC by Matthew Cline
Modified: 2009-10-27 08:42 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthew Cline 2009-10-25 02:24:42 UTC
Version:            (using KDE 4.2.4)
OS:                Linux
Installed from:    Mandriva RPMs

When a filter passes an email header to a command/pipe, it should escape the shell special characters.  For example, if you do:

/usr/bin/foo "%{Subject}"

and the subject contains any double-quotes the the command won't act as you'd expect (and will probably fail if there's an odd number of double-quotes).
Comment 1 Martin Koller 2009-10-26 19:09:21 UTC
As KDE already quotes the arguments, simply do not put quotes around %{Subject}.
E.g. use: /usr/bin/foo %{Subject}
Comment 2 Matthew Cline 2009-10-27 01:10:34 UTC
Maybe I'm doing this wrong, but I have a filter which executes the command:

/usr/bin/kdialog --msgbox "New mail: %{Subject}" &

If I leave out the quotes, all I get is a message box saying "New".
Comment 3 Martin Koller 2009-10-27 08:42:58 UTC
On Tuesday 27 October 2009 01:10:35 matt@nightrealms.com wrote:

> Maybe I'm doing this wrong, but I have a filter which executes the command:
> 
> /usr/bin/kdialog --msgbox "New mail: %{Subject}" &
> 
> If I leave out the quotes, all I get is a message box saying "New".

2 comments:
-) Try: /usr/bin/kdialog --msgbox "New mail: "%{Subject} &
-) New mail notification can be done via kmail internally.
   Check: Settings -> Configure Notifications