这次发布表面上看起来规模不大,但实际上整个代码库都经历了重大的重构和迁移。Magisk 的原生代码过去主要使用 C++,但自 2022 年 4 月以来,我和几位贡献者一直在稳步地用 Rust 重写部分代码。经过多年的努力,项目的 Rust 化进程逐渐加快,截至本次发布时,超过 40% 的原生代码已用 Rust 重写,一些主要的子系统重写已进入 PR 队列,计划合并到下一个版本中。
很多人可能会想,为什么要在项目中引入一门新语言?我这样做的原因实际上并非为了减少内存安全问题(尽管这确实是一个不错的附加好处),而是为了能够使用更现代的编程语言来开发 Magisk。使用 Rust 一段时间后,我清楚地意识到,与使用 C++ 相比,使用 Rust 可以让我编写更正确的代码,也让我更加快乐。大家和我一样感同身受。
更新日志
[常规] 大规模内部重构和代码迁移
[应用] 支持使用 XZ 压缩下载模块 zip 文件
[应用] 禁用系统动画时禁用应用动画
[MagiskMount] 支持使用空白文件节点非系统删除包含模块的文件
[MagiskInit] 重新设计 sepolicy 修补和注入逻辑
[MagiskSU] 更好的 TTY/PTY 支持
This release looks minor at the surface, however, the entire codebase has gone through significant refactoring and migration. The native code in Magisk used to be mainly C++, but several contributors and I have been steadily rewriting parts of the code in Rust since April 2022. After years of effort, the Rust-ification of the project slowly began picking up steam, and at the moment of this release, over 40% of the native code has been rewritten in Rust, with several major subsystem rewrites in the PR queue, planned to be merged for the next release.
Many might wonder, why introduce a new language to the project? My reason is actually not to reduce memory safety issues (although it is a nice side benefit), but to be able to develop Magisk using a more modern programming language. After using Rust for a while, it’s clear to me that using Rust allows me to write more correct code and makes me happier compared to dealing with C++. People share the same sentiment as I do.
Changelog
[General] Massive internal refactoring and code migration
[App] Support downloading module zip files with XZ compression
[App] Disable app animations when system animations are disabled
[MagiskMount] Support systemlessly deleting files with modules using blank file nodes
[MagiskInit] Redesign sepolicy patching and injection logic
[MagiskSU] Better TTY/PTY support