hoehermann / purple-signald

Pidgin libpurple bridge to signald.
GNU General Public License v3.0
153 stars 19 forks source link

Externally saved attachments causes libpurple / bitlbee to crash #74

Closed mooomooo closed 2 years ago

mooomooo commented 2 years ago

It used to work, but I didn't update for a long while so I just pulled the latest HEAD and now when I receive an attachment with external_attachments set to true, bitlbee crashes:

17:09:41 <*status> Error from server: BitlBee crashed! (SIGSEGV received)
17:09:41 <*status> Error from server: This is a bug either in BitlBee or a plugin, ask us on IRC if unsure

The debug logs (not much in there...):

With external_attachments = false (everything works fine, no crashes):

DEBUG prpl-hehoe-signald: got newline delimited message: {...}
DEBUG prpl-hehoe-signald: received type: IncomingMessage
DEBUG prpl-hehoe-signald: Attachment: <IMG ID="1"/><br/><a href="file:///signald/attachments/<hash>">Image (type: image/jpeg)</a><br/>
(process:7): GLib-CRITICAL **: 17:07:00.758: g_string_insert_len: assertion 'len == 0 || val != NULL' failed

With external_attachments = true (this kills bitlbee):

DEBUG prpl-hehoe-signald: got newline delimited message: {...}
DEBUG prpl-hehoe-signald: received type: IncomingMessage

** (process:7): CRITICAL **: 17:09:41.533: purple_conversation_get_im_data: assertion 'conv != NULL' failed
DEBUG prpl-hehoe-signald: Copying attachment from '/signald/attachments/<hash>' to '/var/lib/bitlbee/attachments/<hash>.jpe'
(process:7): GLib-GIO-CRITICAL **: 17:09:41.536: g_file_build_attribute_list_for_copy: assertion 'error == NULL || *error == NULL' failed
hoehermann commented 2 years ago

Thank you for the report. Attachment handling for bitlbee was implemented by fancypantalons in 2020. In 2021, the signald protocol changed, breaking many things. Just a couple of weeks ago, I adapted some parts of the code in the dev branch. They work pretty well, but only for Pidgin. Unfortunately, they have been rather destructive – especially in regard to bitlbee and spectrum – so I do not want to release it as "new version".

I want to take a look at this crash within the next two weeks. Maybe it is an easy fix. If so, the master branch would be updated with a new release. If not, then I need to redesign that part of the attachment handling as well. Maybe @fancypantalons can help again.

hoehermann commented 2 years ago

I managed to replicate the crash and implement a fix. Apparently, error is a global variable somewhere. I updated the master and the dev branch. For me, the master branch is almost completely dysfunctional. The dev branch is working way better for me, but I do not know how well it works for bitlbee since I have not re-implemented all the group-related functions, yet.