Sylvestre Ledru, known for his work building Debian GNU / Linux using the Clang compiler, reported about the successful experiment on using an alternative set of coreutils utilities, Rewritten in Rust. Coreutils includes utilities like sort, cat, chmod, chown, chroot, cp, date, dd, echo, hostname, id, ln and ls. For the first stage of integration into Debian, the Rust version of coreutils set the following goals:
- Creating a package with an alternate Rust version of coreutils for Debian and Ubuntu.
- Boot Debian with the GNOME desktop using rust-coreutils.
- Installs 1000 of the most popular packages from the repository.
- Build from Firefox, LLVM / Clang and Linux kernel sources with rust-coreutils.
After creating over 100 patches for Rust / coreutils, we have successfully achieved all our goals. Ongoing work highlights the implementation of missing utilities and options, improvements in code quality and consistency, development of the test suite, fixing crashes that occur when running the GNU Coreutils test suite (141 out of 613 tests are running successfully so far).
When creating the rust-coreutils package, it was decided not to replace the coreutils package, but to allow them to run in parallel. Rust versions of utilities are installed in / usr / lib / cargo / bin / and activated by adding this directory to the PATH environment variable. The creation of the rust-coreutils package made it difficult to upload all the build dependencies to the repository, including Rust and various crate packages.
There were no special problems creating the boot image, but adapting packages for the rust-coreutils environment took a lot of work, since many post-install scripts call utilities from the coreutils suite. Most of the problems were caused by the lack of necessary options, for example, the “cp” utility lacked the “–archive” and “–no-dereference” options, “ln” did not support the “–relative” option, and mktemp – ” -t “, in sync” -fs “, in install -” –owner “and” –group “. Other problems surfaced due to differences in behavior, for example, the install utility did not support specifying / dev / null as an input file, in mkdir instead of “–parent” there was an option “–parents”, etc.
There were no big problems when testing assemblies of large codebases. When building Firefox and LLVM / Clang, python scripts and cmake are used, so replacing coreutils did not affect them. Building the Linux kernel went relatively smoothly, with only two issues emerging: an error message when using chown with a symlink, and the lack of the “-n” option in the ln utility.