Bug 2659 - E-mail attachments are handled inconsistently
Summary: E-mail attachments are handled inconsistently
Status: RESOLVED FIXED
Alias: None
Product: Claws Mail
Classification: Unclassified
Component: UI/Actions (show other bugs)
Version: 3.8.0
Hardware: PC Linux
: P3 normal
Assignee: users
URL:
Depends on:
Blocks:
 
Reported: 2012-05-09 19:45 CEST by Kevin T. Likes
Modified: 2012-05-11 18:55 CEST (History)
0 users

See Also:


Attachments
Test case for e-mail attachment handling problems (72.64 KB, application/octet-stream)
2012-05-10 23:08 CEST, Kevin T. Likes
no flags Details
Possible patch (1.63 KB, patch)
2012-05-11 12:26 CEST, Colin Leroy
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kevin T. Likes 2012-05-09 19:45:27 CEST
I get mails with other e-mails attached that I need to sort and then resend on to other users. When I drag the e-mail into another folder, I get various results:

1) (Expected) The mail is filed in the new folder.
2) Nothing gets filed.
3) The previous e-mail attachment gets filed instead
4) The entire message that I am trying to take the attachment from gets filed instead.

Type 1 usually only occurs with first or only attachments (but not all ones work that way). I am able to save attachments as files, but that slows down the process.
Comment 1 Paul 2012-05-10 07:54:08 CEST
I suspect that those that fail are broken in some way.
Try running starting Claws with --debug and watch the output when you drag'n'drop, or attach an example message to this report.
Comment 2 Colin Leroy 2012-05-10 08:31:30 CEST
Maybe it's the file_is_email function that wrongly finds some attached emails are not emails.

It looks for Subject, From, To in the first 60 lines of attached files. 

Look for "file is a mail"/"file isn't a mail" in debug output.
Comment 3 Kevin T. Likes 2012-05-10 23:08:42 CEST
Created attachment 1110 [details]
Test case for e-mail attachment handling problems
Comment 4 Kevin T. Likes 2012-05-10 23:13:26 CEST
It does appear that when I have an issue with the first e-mail attachment, it is indeed missing the To: field. I would characterize that as a bug, since Blind-Carbon-Copy is fairly common in e-mails.

In the attached e-mail, I see the following:

1) The first attachment moves fine.
2) If I try to move the second attachment after moving the first, the first is moved again.
3) If I try to move the second attachment immediately after opening the mail, the entire message to which it is attached is moved. 

The second attachment appears to meet all your criteria for being detected. Here is the debug output:

folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2118:newly selected 0x8de3c60, opened 0x8de3c60
folderview.c:2122:TIMING folderview_selected : 0s000ms
folderview.c:2975:file is a mail
msgcache.c:274:TIMING msgcache_get_msg_list : 0s000ms
mh.c:1337:TIMING mh_write_sequences : 0s000ms
msgcache.c:172:Cache size: 1 messages, 345 bytes
procmsg.c:2008:Changing flags for message 9 in folder Spam
folder.c:1216:Counting total number of messages...
main.c:974:The name com.google.code.Awn was not provided by any .service files
Comment 5 Paul 2012-05-11 07:51:21 CEST
The bug here appears to be just in dragging'n'dropping using the mime icons on the right. If I drag'n'drop from the (normally hidden) mime parts list instead then it works fine.
Comment 6 Colin Leroy 2012-05-11 10:18:28 CEST
That emails show more problems: simply left-clicking the last two message/rfc822 icons doesn't update the view. I'll investigate that.
Comment 7 Colin Leroy 2012-05-11 10:40:12 CEST
The problem is that mimeview_tree_next() doesn't walk up multiple parents. This mail is in the following format:
message/rfc822
 multipart/mixed
  multipart/alternative
   text/plain
   text/html
  message/rfc822 *
   multipart/alternative **
    text/plain
    text/html ***
  message/rfc822
   multipart/alternative
    text/plain
    text/html
  message/rfc822
   multipart/alternative
    text/plain
    text/html

and mimeview_tree_next() stops at the *** because it only looks if the first-level parent (**) as a ->next part, not going back to the grand-parent (*).
Comment 8 Colin Leroy 2012-05-11 12:26:17 CEST
Created attachment 1111 [details]
Possible patch

This patch fixes both problems (iteration, and determining whether a file is an email); can you test it ?
Comment 9 users 2012-05-11 18:54:34 CEST
Changes related to this bug have been committed.
Please check latest CVS and update the bug accordingly.
You can also get the patch from:
http://www.claws-mail.org/tracker/

2012-05-11 [colin]	3.8.0cvs40

	* src/mimeview.c
	* src/common/utils.c
		Fix bug 2659, 'E-mail attachments are handled
		inconsistently'
		Fix problems iterating the mime tree, and determine
		whether a file is an email without To:
Comment 10 Colin Leroy 2012-05-11 18:55:12 CEST
2012-05-11 [colin]	3.8.0cvs40

	* src/mimeview.c
	* src/common/utils.c
		Fix bug 2659, 'E-mail attachments are handled
		inconsistently'
		Fix problems iterating the mime tree, and determine
		whether a file is an email without To:

Commited.