[Kolab-devel] Fw: K9 Mail and not able to download Attachments

hede <[email protected]> Tue, 24 Mar 2020 07:35:02 +0100
Newsgroups gmane.comp.kde.devel.kolab
Organization der-he.de
Message-ID <20200324073502.2d77b71f__21694.5090725616$1585031735$gmane$org@hpusdt4.der-he.de>
--MP_/Qf74pZBi+=r3HJG_GmEbyKs
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi all,

anyone working on / responsible for guam? I've fixed a bug, it's working much better now. Still it's not heavily tested.

Btw., anyone administering the kolab.org infrastructure? I tried to file a task at git.kolab.org, but it's not working:

########
Unhandled Exception ("Exception")
Failed to poll mysqli connection!
########

The following text I'd like to open a task/bug report with:

########
"Guam crashes - for example while downloading attachments with K9 Mail

  - pykolab        0.8.18-0~kolab1
  - erlang-eimap 0.4.0-1.1
  - guam 0.9.5-2
(Kolab 16 for Debian 10)

For me guam **was** constantly crashing:


> ... [error] <0.17491.1>@eimap:joined:487 gen_fsm <0.17491.1> in state passthrough terminated with reason: bad argument in call to erlang:bit_size( ...

The reason is: //zlib:inflate()// can return a nested iolist which is not handled by the recursive //joined()// implementation within guam and erlang-eimap. 

But there's a erlang function for converting an iolist to a binary string: [error] <0.17491.1>@eimap:joined:487 gen_fsm <0.17491.1> in state passthrough terminated with reason: bad argument in call to erlang:bit_size(). I'm not experienced with erlang, but I simply replaced the //joined()// by //iolist_to_binary()// and it seems to work fine. **At least the crashes are gone and I cannot see any negatives so far. **"
########

regards
hede






Weitergeleitete Nachricht:

Datum: Sat, 21 Mar 2020 23:48:10 +0100
Von: hede <[email protected]>
An: [email protected]
Betreff: K9 Mail and not able to download Attachments


Hi all, 

for anyone using guam and k9-mail on android: is anybody elsehit by the problem not to be able to download attachments via k9-mail on android? I'm watching this problem since some weeks, or months!?

Monday is my first official day on vacation, today I did my first patch to guam for this holidays. And now I can download attachments again. :-)

Please test my patched erlang-eimap and guam builds, especially if you're using K9 and guam and you are effected by the same problem.

see:
http://obs.kolabsys.com/repositories/home:/hede:/branches:/Kolab:/16/Debian_10.0/amd64/

(it's currently mostly untested - i finished work some minutes ago; I will test this for some days and then submit a request upstream)

regards
hede
_______________________________________________
users mailing list
[email protected]
https://lists.kolab.org/mailman/listinfo/users

--MP_/Qf74pZBi+=r3HJG_GmEbyKs
Content-Type: text/x-patch
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=guam_use_iolist_to_binary.patch

Instead of converting the values from zlib:deflate to binary by hand we can use 
the iolist_to_binary() function from erlang; this allows us to convert
also nested iolists.
diff -rupN guam-0.9.5.ori/apps/kolab_guam/src/kolab_guam_session.erl guam-0.9.5/apps/kolab_guam/src/kolab_guam_session.erl
--- guam-0.9.5.ori/apps/kolab_guam/src/kolab_guam_session.erl	2019-11-18 11:03:06.000000000 +0100
+++ guam-0.9.5/apps/kolab_guam/src/kolab_guam_session.erl	2020-03-21 23:22:32.236604867 +0100
@@ -238,17 +238,14 @@ process_client_data(Socket, Data, #state
 preprocess_client_data(undefined, Data, #state{ buffered_client_data = Buffered }) ->
     <<Buffered/binary, Data/binary>>;
 preprocess_client_data(Z, Data, #state{ buffered_client_data = Buffered }) ->
-    Inflated = joined(zlib:inflate(Z, Data), <<>>),
+    Inflated = iolist_to_binary(zlib:inflate(Z, Data)),
     <<Buffered/binary, Inflated/binary>>.
 
 postprocess_server_data(undefined, Data) ->
     %% we aren't compressing so there is nothing to do
     Data;
 postprocess_server_data(Z, Data) ->
-    joined(zlib:deflate(Z, Data, sync), <<>>).
-
-joined([], Binary) -> Binary;
-joined([H|Rest], Binary) -> joined(Rest, <<Binary/binary, H/binary>>).
+    iolist_to_binary(zlib:deflate(Z, Data, sync)).
 
 init_rules(RuleConfig) -> init_rule(RuleConfig, []).
 init_rule([], Acc) -> Acc;

--MP_/Qf74pZBi+=r3HJG_GmEbyKs
Content-Type: text/x-patch
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename=erlang-eimap_use_iolist_to_binary.patch

Instead of converting the values from zlib:deflate to binary by hand we can use 
the iolist_to_binary() function from erlang; this allows us to convert
also nested iolists.
diff -rupN eimap-0.4.0.ori/src/eimap.erl eimap-0.4.0/src/eimap.erl
--- eimap-0.4.0.ori/src/eimap.erl	2016-11-11 15:49:11.000000000 +0100
+++ eimap-0.4.0/src/eimap.erl	2020-03-21 20:36:12.850230642 +0100
@@ -478,13 +478,10 @@ reenque_command(Command, State) ->
     State#state { command_queue = queue:in_r(Command, State#state.command_queue) }.
 
 inflated(Data, #state{ inflator = undefined }) -> Data;
-inflated(Data, #state{ inflator = Inflator }) ->  joined(zlib:inflate(Inflator, Data), <<>>).
+inflated(Data, #state{ inflator = Inflator }) ->  iolist_to_binary(zlib:inflate(Inflator, Data)).
 
 deflated(Data, #state{ deflator = undefined }) -> Data;
-deflated(Data, #state{ deflator = Deflator }) ->  joined(zlib:deflate(Deflator, Data, sync), <<>>).
-
-joined([], Binary) -> Binary;
-joined([H|Rest], Binary) -> joined(Rest, <<Binary/binary, H/binary>>).
+deflated(Data, #state{ deflator = Deflator }) ->  iolist_to_binary(zlib:deflate(Deflator, Data, sync)).
 
 reset_timeout(#state{ command_timeout = Timeout } = State) ->
     cancel_timeout(State),

--MP_/Qf74pZBi+=r3HJG_GmEbyKs
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
devel mailing list
[email protected]
https://lists.kolab.org/mailman/listinfo/devel
--MP_/Qf74pZBi+=r3HJG_GmEbyKs--