Giter VIP home page Giter VIP logo

Comments (14)

gauteh avatar gauteh commented on July 19, 2024

Do you have a minimal/anonymized version of the email that I could use?
It would be easier to test it out on that.

Is this an attached mime-message which you open in Astroid? Does the
thread open and only crash when you try to open the attachment, or at
once when you open the thread?

from astroid.

hugoroy avatar hugoroy commented on July 19, 2024

I just sent you an email with which I can reproduce the bug. Here's the output:

[debug] (23:02:04): ky: Mode,  unknown key: j
[debug] (23:02:04): ky: ThreadIndex mode, handling: j (thread_index.next_thread)
[debug] (23:02:05): ky: Mode,  unknown key: k
[debug] (23:02:05): ky: ThreadIndex mode, handling: k (thread_index.prev_thread)
[debug] (23:02:07): ky: Mode,  unknown key: Return
[debug] (23:02:07): ky: ThreadIndex mode, handling: Return (thread_index.open_thread)
[debug] (23:02:07): ti: open thread: 000000000001f362 (1)
[info ] (23:02:07): tv: using user html file: /home/hugo/.config/astroid/ui/thread-view.html
[debug] (23:02:07): tv: testing version: 1
[info ] (23:02:07): tv: using user css file: /home/hugo/.config/astroid/ui/thread-view.css
[debug] (23:02:07): tv: testing version: 1
[debug] (23:02:07): key: registering key: thread_view.down: j
[debug] (23:02:07): key: registering key: thread_view.next_element: C-j
[debug] (23:02:07): key: registering key: thread_view.scroll_down: J
[debug] (23:02:07): key: alias: Down(65364)
[debug] (23:02:07): key: registering key: thread_view.page_down: C-J
[debug] (23:02:07): key: alias: C-Down(65364)
[debug] (23:02:07): key: alias: 65366(65366)
[debug] (23:02:07): key: registering key: thread_view.up: k
[debug] (23:02:07): key: registering key: thread_view.previous_element: C-k
[debug] (23:02:07): key: registering key: thread_view.scroll_up: K
[debug] (23:02:07): key: alias: Up(65362)
[debug] (23:02:07): key: registering key: thread_view.page_up: C-K
[debug] (23:02:07): key: alias: C-Up(65362)
[debug] (23:02:07): key: alias: 65365(65365)
[debug] (23:02:07): key: registering key: thread_view.home: 1
[debug] (23:02:07): key: alias: Home(65360)
[debug] (23:02:07): key: registering key: thread_view.end: 0
[debug] (23:02:07): key: alias: End(65367)
[debug] (23:02:07): key: registering key: thread_view.activate: Return
[debug] (23:02:07): key: alias: KP_Enter(65421)
[debug] (23:02:07): key: registering key: thread_view.save: s
[debug] (23:02:07): key: registering key: thread_view.delete: d
[debug] (23:02:07): key: registering key: thread_view.open: o
[debug] (23:02:07): key: registering key: thread_view.expand: e
[debug] (23:02:07): key: registering key: thread_view.toggle_expand_all: C-e
[debug] (23:02:07): key: registering key: thread_view.mark: t
[debug] (23:02:07): key: registering key: thread_view.toggle_mark_all: T
[debug] (23:02:07): key: registering key: thread_view.show_remote_images: C-i
[debug] (23:02:07): key: registering key: thread_view.save_all_attachments: S
[debug] (23:02:07): key: registering key: thread_view.next_message: n
[debug] (23:02:07): key: registering key: thread_view.next_message_expand: C-n
[debug] (23:02:07): key: registering key: thread_view.previous_message: p
[debug] (23:02:07): key: registering key: thread_view.previous_message_expand: C-p
[debug] (23:02:07): key: registering key: thread_view.reply: r
[debug] (23:02:07): key: registering key: thread_view.reply_all: G
[debug] (23:02:07): key: registering key: thread_view.forward: f
[debug] (23:02:07): key: registering key: thread_view.flat: C-f
[debug] (23:02:07): key: registering key: thread_view.view_raw: V
[debug] (23:02:07): key: registering key: thread_view.edit_draft: E
[debug] (23:02:07): key: registering key: thread_view.multi.toggle: t
[debug] (23:02:07): key: registering key: thread_view.multi.save: s
[debug] (23:02:07): key: registering key: therad_view.multi: +
[info ] (23:02:07): tv: load thread: 000000000001f362
[info ] (23:02:07): db: open db read-only.
[debug] (23:02:07): db: open time: 0.23 ms.
[info ] (23:02:07): msg: loading mid: [email protected]
[info ] (23:02:07): msg: filename: /home/hugo/Mail/ampoliros/Envoyes/cur/1451858452_0.8031.xps,U=2240,FMD5=f390ab84202335e9b190e29a5c64daa4:2,S
[debug] (23:02:07): chunk: content-type: multipart/signed
[debug] (23:02:07): chunk: multi part
[debug] (23:02:07): chunk: alternative: 0
[debug] (23:02:07): chunk: content-type: multipart/mixed
[debug] (23:02:07): chunk: multi part
[debug] (23:02:07): chunk: alternative: 0
[debug] (23:02:07): chunk: content-type: text/plain
[debug] (23:02:07): chunk: preferred.
[debug] (23:02:07): chunk: is part (viewable: 1, attachment: 0) 
[debug] (23:02:07): chunk: content-type: message/rfc822
[debug] (23:02:07): chunk: message part

(astroid:8670): gmime-CRITICAL **: g_mime_content_type_to_string: assertion 'GMIME_IS_CONTENT_TYPE (mime_type)' failed
[debug] (23:02:07): chunk: content-type: 
[debug] (23:02:07): chunk: mime message
[debug] (23:02:07): chunk: multi part end
[debug] (23:02:07): chunk: content-type: application/pgp-signature
[debug] (23:02:07): chunk: is part (viewable: 0, attachment: 1) 
[debug] (23:02:07): chunk: multi part end
[info ] (23:02:07): render: loading html..
[info ] (23:02:07): tv: navigation action: 5
[info ] (23:02:07): tv: navigating to: /home/hugo/.config/astroid/k5pxepv9x1ayfla371bmprzgm1cjomkwm7jl01vt6auqqupi7x8p8zmmsioazxacc19lfriy6zdcts5v0kz3eyrmzx9z7k79m967ol5pi65uqj3pefzj48co
[debug] (23:02:07): tv: on_load_changed: 0
[info ] (23:02:07): db: closing db.
[debug] (23:02:07): tv: on_load_changed: 1
[debug] (23:02:07): tv: on_load_changed: 3
[debug] (23:02:07): tv: on_load_changed: 2
[debug] (23:02:07): tv: load finished.
[debug] (23:02:07): tv: mathjax request: approved
[debug] (23:02:07): tv: code prettify request: approved
[debug] (23:02:07): render: html loaded, building messages..
[debug] (23:02:07): tv: adding message: [email protected]
[debug] (23:02:07): gravatar: for: XXXXXfsfe.org, uri: http://www.gravatar.com/avatar/c2502eb125052a741348c3ae2eec036a?d=retro&s=48
[info ] (23:02:07): db: open db read-only.
[debug] (23:02:07): db: open time: 0.256 ms.
[info ] (23:02:07): db: closing db.
[debug] (23:02:07): create message part: 0 (siblings: 0) (kids: 2) (attachment: 0) (viewable: 0) (mimetype: multipart/signed)
[debug] (23:02:07): create message part: 1 (siblings: 0) (kids: 2) (attachment: 0) (viewable: 0) (mimetype: multipart/mixed)
[debug] (23:02:07): create message part: 2 (siblings: 0) (kids: 0) (attachment: 0) (viewable: 1) (mimetype: text/plain)
[debug] (23:02:07): create body part: 2
[debug] (23:02:07): chunk: body: part
[debug] (23:02:07): chunk: plain text (out html: 1)
[debug] (23:02:07): enc: quoted-printable
[debug] (23:02:07): charset: utf-8
[debug] (23:02:07): mq: quote filter done, time: 0 ms.
[debug] (23:02:07): tv: code filter done, time: 0 ms.
[debug] (23:02:07): create message part: 3 (siblings: 0) (kids: 1) (attachment: 0) (viewable: 0) (mimetype: message/rfc822)

(astroid:8670): gmime-CRITICAL **: g_mime_content_type_to_string: assertion 'GMIME_IS_CONTENT_TYPE (mime_type)' failed
terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_M_construct null not valid
[1]    8670 abort (core dumped)  astroid

Is this an attached mime-message which you open in Astroid? Does the thread open and only crash when you try to open the attachment, or at once when you open the thread?

It crashes right away from the thread_index, I never get to thread_view

from astroid.

gauteh avatar gauteh commented on July 19, 2024

Hugo Roy writes on January 3, 2016 23:03:

I just sent you an email with which I can reproduce the bug. Here's the output:

Yup, that does it :) Do you mind if I include it in the tests as it is
now (I haven't really looked at it of course :p)?

from astroid.

hugoroy avatar hugoroy commented on July 19, 2024

from astroid.

hugoroy avatar hugoroy commented on July 19, 2024

FYI, another email crashing debut output:

[debug] (23:29:39): create body part: 4
[debug] (23:29:39): chunk: body: part
[debug] (23:29:39): chunk: plain text (out html: 1)
[debug] (23:29:39): enc: 8bit
[debug] (23:29:39): charset: UTF-8
[debug] (23:29:39): mq: quote filter done, time: 0 ms.
[debug] (23:29:39): tv: code filter done, time: 0 ms.
[debug] (23:29:39): create message part: 5 (siblings: 0) (kids: 1) (attachment: 0) (viewable: 0) (mimetype: message/rfc822)

(astroid:6697): gmime-CRITICAL **: g_mime_content_type_to_string: assertion 'GMIME_IS_CONTENT_TYPE (mime_type)' failed
terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_M_construct null not valid
[1]    6697 abort (core dumped)  astroid

from astroid.

ff2000 avatar ff2000 commented on July 19, 2024

The message "[Gaudenz Steinlin] Bug#810784 [....]" by David Bremner arrived yesterday (jan.12 2015) via the notmuch mailing list which also crashes astroid. Should be the same reason.

from astroid.

ff2000 avatar ff2000 commented on July 19, 2024

The following patch fixes the issue:

diff --git a/src/modes/thread_view/thread_view.cc b/src/modes/thread_view/thread_view.cc
index 58abf08..548089a 100644
--- a/src/modes/thread_view/thread_view.cc
+++ b/src/modes/thread_view/thread_view.cc
@@ -1031,7 +1031,9 @@ namespace Astroid {
       bool /* check_siblings */)
   {

-    ustring mime_type = ustring(g_mime_content_type_to_string (c->content_type));
+    ustring mime_type;
+    if(c && c->content_type)
+      mime_type = ustring(g_mime_content_type_to_string (c->content_type));

     log << debug << "create message part: " << c->id << " (siblings: " << c->siblings.size() << ") (kids: " << c->kids.size() << ")" <<
       " (attachment: " << c->attachment << ")" << " (viewable: " << c->viewable << ")" << " (mimetype: " << mime_type << ")" << endl;

But I don't konw if it's the best to deal with the issue this way...

from astroid.

gauteh avatar gauteh commented on July 19, 2024

ff2000 writes on January 13, 2016 9:35:

The following patch fixes the issue:

diff --git a/src/modes/thread_view/thread_view.cc b/src/modes/thread_view/thread_view.cc
index 58abf08..548089a 100644
--- a/src/modes/thread_view/thread_view.cc
+++ b/src/modes/thread_view/thread_view.cc
@@ -1031,7 +1031,9 @@ namespace Astroid {
       bool /* check_siblings */)
   {

-    ustring mime_type = ustring(g_mime_content_type_to_string (c->content_type));
+    ustring mime_type;
+    if(c && c->content_type)
+      mime_type = ustring(g_mime_content_type_to_string (c->content_type));

should probably have:

} else {
mime_type = "unknown";
}

 log << debug << "create message part: " << c->id << " (siblings: " << c->siblings.size() << ") (kids: " << c->kids.size() << ")" <<
   " (attachment: " << c->attachment << ")" << " (viewable: " << c->viewable << ")" << " (mimetype: " << mime_type << ")" << endl;
But I don't konw if it's the best to deal with the issue this way...

I hope so, can you open the mime-message afterwards?

Also, need to fix the gmime warning in chunk.cc (check the output from
the test-case in #55.

Would be great with a PR, please include the commit from #55 in it too!

from astroid.

gauteh avatar gauteh commented on July 19, 2024

Gaute Hope writes on January 13, 2016 9:40:

ff2000 writes on January 13, 2016 9:35:

The following patch fixes the issue:

diff --git a/src/modes/thread_view/thread_view.cc b/src/modes/thread_view/thread_view.cc
index 58abf08..548089a 100644
--- a/src/modes/thread_view/thread_view.cc
+++ b/src/modes/thread_view/thread_view.cc
@@ -1031,7 +1031,9 @@ namespace Astroid {
       bool /* check_siblings */)
   {

-    ustring mime_type = ustring(g_mime_content_type_to_string (c->content_type));
+    ustring mime_type;
+    if(c && c->content_type)
+      mime_type = ustring(g_mime_content_type_to_string (c->content_type));

should probably have:

} else {
mime_type = "unknown";
}

Rather, it should be:

  mime_type = "application/octet-stream";

as on line 1625. and you do not need to check if (c), only if
content_type == NULL.

from astroid.

ff2000 avatar ff2000 commented on July 19, 2024

Oh, didn't see your new comments. Need to rebase, which might take some time, as I am not that good at git ;)

from astroid.

gauteh avatar gauteh commented on July 19, 2024

The way I would use git here is to keep fixing the minor imporvements and adding them to the branch (as commits), once it matures I would use git rebase -i to squash some of the commits that are not needed to keep in the history. The final rebase is something I could do as well before merging to master. That way it is easy for me to keep track of which comments or improvements have been taken care of.

from astroid.

ff2000 avatar ff2000 commented on July 19, 2024

I know about rebase -i and squash. My issue was, that I merged your commit from #55, then added the changes, so the commits to squash were not follow-ups. I didn't know I can reorder commits in rebase -i which safed my issue ;)
Everything should be OK now.

from astroid.

gauteh avatar gauteh commented on July 19, 2024

ff2000 writes on January 13, 2016 10:56:

I know about rebase -i and squash. My issue was, that I merged your commit from #55, then added the changes, so the commits to squash were not follow-ups. I didn't know I can reorder commits in rebase -i which safed my issue ;)
Everything should be OK now.

Thanks, merged, this issue should be fixed now.

from astroid.

hugoroy avatar hugoroy commented on July 19, 2024

It works! :-)

Thanks a lot

from astroid.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.