Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[guile] The message body is duplicated for MIME messages #2802

Closed
bauermann opened this issue Jan 3, 2025 · 1 comment
Closed

[guile] The message body is duplicated for MIME messages #2802

bauermann opened this issue Jan 3, 2025 · 1 comment
Labels

Comments

@bauermann
Copy link
Contributor

Describe the item

When the mu:body message method is called on a MIME message after a call to mu:header, the body text is duplicated in the returned value.

To Reproduce

With the commits from PR #2801 applied, add the following test to the test-message function in test-mu-guile.scm:

(str-equal-or-exit (mu:body msg)
                   "Hello world, forwarding some RFC822 message\n")

If you add it before the call to mu:header, it will pass. If you add it after, you get:

not ok /guile/message - ERROR:../guile/tests/test-mu-guile.cc:89:void test_something(const char*): assertion failed: (0)
Bail out!
----------------------------------- stderr -----------------------------------
*ERROR*: Expected "Hello world, forwarding some RFC822 message
", got "Hello world, forwarding some RFC822 message
Hello world, forwarding some RFC822 message

Environment
This is on Guix with Guile 3.0.9.
mu is v1.12.8 with the commits from PR #2801 applied.

Checklist

  • [✓] you are running either the latest 1.4.x release, or a 1.5.11+ development release (otherwise, please upgrade).

Analysis

I did some debugging, and I believe the problem happens because mu:c:get-parts and mu:c:get-header call Message::unload_mime_message() at the end.

Because of this, next time Message::load_mime_message() gets called, priv_->mime_msg will be empty and fill_document(*priv_) will add a new instance of the body text in accumulate_text().

bauermann added a commit to bauermann/mu that referenced this issue Jan 8, 2025
Somewhere along the way, the body-txt and body-html fields were merged
into a single body field. Later, commit 8eac392 ("guile: re-enable
the guile support") finally removed support for Field::Id::BodyHtml from
mu:c:get-field.

Unfortunately mu.scm and the documentation are still stuck in the past, so
update them. mu:body-txt is now a synonym for mu:body, and mu:body-html
always returns #f.

I wanted to add a mu:body test also for the rfc822.1 message, but there's
currently a bug where its body text is is duplicated (issue djcb#2802), so the
test would fail.
@djcb
Copy link
Owner

djcb commented Jan 15, 2025

The (current) guile bindings have been deprecated for quite some time, so i'm not planning to do much work on this. But perhaps we can quickly fix this,

@djcb djcb removed the new label Jan 15, 2025
@djcb djcb closed this as completed in c088760 Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants