Bug 260638 - Filter Action "pipe through" doesn't change the E-Mail
Summary: Filter Action "pipe through" doesn't change the E-Mail
Status: RESOLVED FIXED
Alias: None
Product: kmail2
Classification: Unclassified
Component: filtering (show other bugs)
Version: 2.0.89
Platform: openSUSE RPMs Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-18 16:12 UTC by biesold
Modified: 2013-03-14 12:21 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Script to edit mails with 'Pipe through' (556 bytes, text/plain)
2013-03-14 12:21 UTC, Juanma
Details

Note You need to log in before you can comment on or make changes to this bug.
Description biesold 2010-12-18 16:12:54 UTC
Version:           2.0.89 (using KDE 4.5.85) 
OS:                Linux

i.e. pipe through "/usr/bin/spamassassin | tee /tmp/out.txt" dosn't give me the Spammassassin-markups in Kmail, but in the file out.txt.

Reproducible: Always
Comment 1 T Zumbrunn 2011-02-25 10:02:20 UTC
Version:           1.13.6 (using KDE 4.5.5) 
OS:                Linux (openSUSE packages)

I have the same problem with another version of Kmail. A simple example bash script acting as a filter would e.g. be:

#!/bin/bash
sed -n '1h;1!H;${;g;s/foo/bar/g;p;}'

If I save this script to a file, make it executable, add it to my PATH and then use it in a Kmail filter action "pipe through" for incoming messages, the messages are not changed. However, if I apply the filter via the menu "Apply Filter", the messages are changed.
Comment 2 T Zumbrunn 2011-02-25 12:04:44 UTC
I'd like to withdraw my previous comment. I made a mistake by searching for a header field which is only added by Kmail after the "pipe through" filter action.
Comment 3 CaCO3 2011-05-22 12:45:18 UTC
I have exactly the same problem :(
I have a script shich should replace a character by another one:
----8<----------
#!/bin/bash
sed -n '1h;1!H;${;g;s/-/*/g;p;}' > /tmp/filter.txt ; cat /tmp/filter.txt
----8<----------
I added it to the filter settings (pipe through).
When I apply this filter to an email, the email body does not change. How ever when I check the content of /tmp/filter.txt, it contains the changed email.
Or when I run the script in the terminal

echo "aaa-bb-cc" | Scripts/kmail_sleepanalyser_bug_filter.sh

it returns the changed content.

So this means to me that my script works, how ever kmail seems not to take the changed content.

Any suggestions what I am doing wrong?
Comment 4 Tobias Koenig 2011-06-04 10:55:07 UTC
Git commit 49852b34c2701dbd9ba3d10e3530b8cdb3949bb8 by Tobias Koenig.
Committed on 04/06/2011 at 11:00.
Pushed by tokoe into branch 'master'.

Write back changed item payload to Akonadi storage

This fixes the 'pipe through' filter action in KMail.

BUG: 260638

M  +2    -0    mailcommon/filteraction.cpp     

http://commits.kde.org/kdepim/49852b34c2701dbd9ba3d10e3530b8cdb3949bb8
Comment 5 Tobias Koenig 2011-06-04 11:05:13 UTC
Hej,

this bug has been fixed in the meantime and is not reproducible in current master branch.

Ciao,
Tobias
Comment 6 Tobias Koenig 2011-06-06 13:56:20 UTC
Git commit e24f96fe1679ec674db0e2f192af0e6ced782653 by Tobias Koenig.
Committed on 04/06/2011 at 11:00.
Pushed by tokoe into branch '4.6'.

Write back changed item payload to Akonadi storage

This fixes the 'pipe through' filter action in KMail.

BUG: 260638
(cherry picked from commit 49852b34c2701dbd9ba3d10e3530b8cdb3949bb8)

M  +2    -0    mailcommon/filteraction.cpp     

http://commits.kde.org/kdepim/e24f96fe1679ec674db0e2f192af0e6ced782653
Comment 7 Sverre Froyen 2012-01-19 04:08:00 UTC
Has there been a regression for this bug? I'm seeing this exact behavior with 4.8RC2 when (manually) applying a pipe-through-bogofilter filter to a message in my input folder. Using the tee construct in the original bug report, the /tmp/out.txt contains the expected X-Bogosity header whereas the file in the input folder does not. Both files have the same modification date, however.

This is on NetBSD-current (I'm working on a port of 4.8).
Comment 8 Paolo Herms 2012-08-21 12:37:22 UTC
I confirm the problem reappears on manual filtering in kmail 4.9.
Can this bug be reopened?
Comment 9 Laurent Montel 2012-08-21 13:05:45 UTC
Give exacte method, filter that you use for reproduce it please.
Comment 10 Paolo Herms 2012-08-21 13:14:42 UTC
Just as Sverre Froyen described, when I click on an existing email and do "Apply all filters", then my filter rule with a pipe through action is triggered and the command launched as shown by filter log viewer and output of the command stored with tee, but the message is left unchanged. The filter works correctly on newly incoming mails.
Comment 11 Juanma 2013-03-14 12:21:49 UTC
Created attachment 78057 [details]
Script to edit mails with 'Pipe through'

I'm using KMail version 4.9.5 and I get the same behavior described above.
I have a script that copies the whole message (STDIN) to a temporary file, opens an editor with that file, waits for the editor to close and then cat's the file to STDOUT. I use it in manual filtering with 'Pipe through', but now it doesn't change the message (the temporary file is correctly changed)
I upload the script and request the bug to be re-opened.