Bug 211735

Summary: Escape shell special characters when passing %{foo} to command/pipe
Product: [Applications] kmail Reporter: Matthew Cline <matt>
Component: generalAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED INTENTIONAL    
Severity: normal CC: kollix
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Mandriva RPMs   
OS: Linux   
Latest Commit: Version Fixed In:

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