Bug 4327 - Rule Action 'Execute' - Message Elements passed have extra backslashes
Summary: Rule Action 'Execute' - Message Elements passed have extra backslashes
Status: NEW
Alias: None
Product: Claws Mail (Windows)
Classification: Unclassified
Component: default (show other bugs)
Version: 3.17.4
Hardware: PC Windows 10
: P3 normal
Assignee: users
URL:
Depends on:
Blocks:
 
Reported: 2020-03-30 21:47 UTC by chainsawuser
Modified: 2021-09-14 02:46 UTC (History)
0 users

See Also:


Attachments

Description chainsawuser 2020-03-30 21:47:49 UTC
For Rule Action 'Execute', the message elements passed have extra backslashes.
It looks like anything that is not a letter or number is escaped with '\'.

To test I created a Processing Rule on an individual folder with one message in
it, as shown below.
      Name:  Test
 Condition:  all
    Action:  execute "set \"test=%F\" & set test & pause"

I then changed symbol %F to %d, then to %s and the output for each is below.
The problem happens with every symbol.

--Filename--
%F output:
C\:\\Users\\Chainsaw\\Desktop\\Claws\ Mail\\ClawsLocalMailbox\\inbox\\1
Actual filename:
C:\Users\Chainsaw\Desktop\Claws Mail\ClawsLocalMailbox\inbox\1

--Date--
%d output:
Fri\,\ 27\ Mar\ 2020\ 08\:25\:01\ \-0400
Actual date:
Fri, 27 Mar 2020 08:25:01 -0400

--Subject--
%s output:
This\ is\ the\ Subject\ Line\.
Actual subject:
This is the Subject Line.

However, the 'Shell command' symbols used in an Action output perfectly.
Comment 1 chainsawuser 2021-09-13 14:02:29 UTC
Still an issue in Windows 4.0.0.

If you add this action to actionswinrc, you can quickly see the issue for several of the Execute variables.

Filter Execute fields: %as{execute "echo Subject & 0<nul set /p \"nulvar=%s\" & echo: & pause" execute "echo From & 0<nul set /p \"nulvar=%f\" & echo: & pause" execute "echo To & 0<nul set /p \"nulvar=%t\" & echo: & pause" execute "echo Date & 0<nul set /p \"nulvar=%d\" & echo: & pause" execute "echo Message-ID & 0<nul set /p \"nulvar=%i\" & echo: & pause" execute "echo References & 0<nul set /p \"nulvar=%r\" & echo: & pause" execute "echo filename & 0<nul set /p \"nulvar=%F\" & echo: & pause"}
Comment 2 Paul 2021-09-13 15:16:00 UTC
Perhaps there's something I don't understand here. You say it works perfectly, but you don't like seeing the escape character (\) in front of characters that need escaping?
Comment 3 chainsawuser 2021-09-14 02:46:48 UTC
I get the feeling you are just looking at the action I provided in Comment 1, and are referring to the escaped quotes for the action syntax.  Definitely not what I am talking about.

Did you run the 'Filter Execute fields' action I provided?

In the Actions configuration dialog, there is 'Shell command' and 'Filter action'.

Execute is a 'Filter action' and clearly has a bug with the extra backslashes in the outputted parameter arguments.  Execute has its own set of parameters (symbols) shown in its respective 'information' dialog.

'Shell command' (which I said outputs perfectly) is totally separate and outputs its parameter arguments correctly.  'Shell command' has its own set of parameters shown in its respective 'information' dialog. For example, if you create a 'Shell command' action with the following Command, you will see the filename does not have the extra backslashes.
cmd.exe /c echo %f & pause &

Note You need to log in before you can comment on or make changes to this bug.