As some of you are aware there were a lot of changes
the last weeks in rust-core:
Thanks to everybody who contributed and of course most to @dignifiedquire
who kick-started and guides the crazy efforts on April 26th, 2019 now
known as rust core or DCC-RS sometimes.
However, master is currently less stable than it was beginning June -- i guess
that 4e41dbf5ab0bf23de57ea6c0841b50047b382ff0 was still quite stable FYI.
On Master there are bugs like "E2E-encryption unavailable unexpectedly" (#233) and
incoming messages appearing corrupted (#223). At the same time, it's not easy
to debug those as there still is a lot of hard-to-read code that stems from
the original C2Rust translation. Here is an example of a merged PR that
removes some of those "goto" reminescences:
The idea here and probably with many other commits is to *separate functional changes
from re-indentation changes* to allow precise review. It's very easy to introduce
logical bugs if no one can properly compared "before/after". Cleanup PRs typically
should come in a Two-Commit form: one commit changing only logic (minimize indentation changes)
and one only doing "cargo fmt". You typically only review the first commit
and trust that the committer really did nothing else than "cargo fmt" in
the second. Cleanup PRs can be easily done by Rust-newcomers and they
greatly help readability and debuggability of everything. Here is
the current count of unsafe/free/goto usages in core:
dc_tools.rs unsafe: 91 free: 59 goto-blocks: 4
dc_msg.rs unsafe: 60 free: 38 goto-blocks: 3
dc_chat.rs unsafe: 70 free: 30 goto-blocks: 0
dc_imex.rs unsafe: 14 free: 30 goto-blocks: 48
dc_configure.rs unsafe: 15 free: 20 goto-blocks: 38
dc_contact.rs unsafe: 51 free: 19 goto-blocks: 0
dc_mimeparser.rs unsafe: 29 free: 29 goto-blocks: 12
dc_job.rs unsafe: 28 free: 11 goto-blocks: 29
dc_receive_imf.rs unsafe: 16 free: 22 goto-blocks: 19
dc_securejoin.rs unsafe: 13 free: 14 goto-blocks: 29
total unsafe: 653
total free: 436
total gotoblocks: 234
Note that the latter total is down ~20% compared to June 8/4e41dbf5ab0bf23de57ea6c0841b50047b382ff0:
total unsafe: 768
total free: 565
total gotoblocks: 294
The list can be obtained by executing "python top_level_evil.py" in the src dir.
It'd be good to accelerate this cleanup-by-cleanup effort in order to help overall stability
and readability. You may look at the "dc_*.c" counterpart file in
if editing a rust-file -- often there are also comments which are good to transfer.
Floris' note made sense to me here: "it probably will get worse before it gets better".
As long as we have tons of unsafe/safe boundaries, changing some of them
can easily corrupt others.
There also are deeper cleanup-PRs like the past sqlite, strbuilder ones or the current
https://github.com/deltachat/deltachat-core-rust/pull/211 (dc_array as Rust vector)
https://github.com/deltachat/deltachat-core-rust/pull/188 (new stock strings API)
Such cleanup-PRs require more Rust-knowledge already but also have a much deeper
pleasurable effect ;) I btw recommend all rust-beginners to watch the repo
and follow PRs and comments. Lots of little things to learn there ;)
There are some more ideas on larger scale cleanups (requiring deeper knowledge), eg:
- remove all usage of char* path-handling code contained in dc_tools.rs
with rust Path usage. This also removes a lot of alloc/free code in
- encasuplate (and finally) replace "mmime" (the mime-parser C2Rust translated
from libetpan) such that core code (dc_mimeparser as consumer and producer
of APIs) does not leak C-pointers left and right and forces one to use
"carray" or "clist" in regular core-rust vectors. I gues that
Friedel/@dignifiedquire and Bjoern/@r10s might have more refined
ideas on how this could be done.
- please tell ;)
Lastly, i mentioned the Rust-sprint idea but i am myself not available
in August and first half september there already is a UX/DC gathering
which focuses strongly on UX issues, so not good to mix with rust-core.
It seems likely that in the week of Sept 23-30th several folks
interested in DC and/or Rust will hang out in Freiburg/DE to do hack
sessions and discussions around rust-core together. Also the-compiler
and me intend to use 2 days in that week to advance DC chat bots and
maybe start a PyQT-based DC client for added fun. If anyone wants
to join but lacks money to make the travel, please mail me.
On a related side note Bjoern and Richy are continuing to focus
on getting a major reworked "Delta/iOS" version out soon (tm).
Delta/iOS uses rust-core so fixing the aforementioned bug-showstoppers
remains a priority as well. Also, OAUTH2 is not working again yet (#119).
I think i am not the only one looking very much forward to having
rust-core become stable and nice :) It is the single basis for all DC apps and
will allow many interesting new feature and UX developments ... on which
several of us also want to engage in 2019 ... For one, there are the longer standing
issues from our Cuban friends who need better control over data/server-storage
usage ... but also needs from people who need alternatives when Signal,
Whatsapp or other centralised services are blocked ... which happens and
threatens to happen in many places these days.
so much for now, keep up all the good work and thanks for any help!
holger (who is mostly afk in August)
P.S.: subscription to mailing list:
chatting with folks: #deltachat on freenode
there is the idea to convene in Freiburg/DE for some rust-hacking days
on Delta Chat core, the library that is used by all Delta Chat apps and
OX/COI apps, as well as chat bot code. https://github.com/deltachat/deltachat-core-rust
If you are interested to help out and learn/deepen your Rust and
get involved with DCC core, please send me a private mail (at best
from Delta Chat). This way you'd be included in arranging timing.
Feel free to send this on to friends as well.
We'll also be getting more funding from the OpenTechFund for 2019/2020
so if you are looking for receiving some money and helping DC developments
we'd be happy to find arrangements! To begin with, we can provide travel funding
and accomodation when you join a gathering. Note that several of the core contributors
to Delta Chat are also newbies to Rust, and there are a lot of different things to
do for different levels of expertise.
there is a new python bindings release for the deltachat core library.
Main news: it's based on the experimental deltachat-core in Rust.
On Linux you can simply issue "pip install deltachat" without
any prior steps. More docs and install instructions here:
If you want to help with lots of cleanup work,
and learn Rust by doing that, be our guest and checkout
You can find and chat with developers on #deltachat freenode.
- use new experimental full-Rust Delta Chat core
- support Autocrypt Setup Messages
- remove synchronous events
- use CircleCI for continous integration and packaging of Linux wheels
- use docker image for building wheels
- fix code documentation links