Adapting Debian to use the Rust implementation of coreutils

Sylvestre Ledru, known for his work building Debian GNU/Linux using the Clang compiler, reported a successful experiment involving an alternative set of coreutils rewritten in Rust. Coreutils includes utilities such as sort, cat, chmod, chown, chroot, cp, date, dd, echo, hostname, id, ln, and ls. For the first stage of integration into Debian of the Rust version of coreutils, the following goals were set:

  • Bundling Rust alternative coreutils for Debian and Ubuntu.
  • Booting Debian with the GNOME desktop using rust-coreutils.
  • Installing the 1000 most popular packages from the repository.
  • Build from Firefox, LLVM/Clang sources and the Linux kernel in a rust-coreutils environment.

After creating more than 100 patches for Rust/coreutils, we managed to successfully implement all the intended goals. From the ongoing work, the implementation of the missing utilities and options, the improvement of the quality and uniformity of the code, the development of the test suite, the elimination of crashes that occur when running the test suite from GNU Coreutils (so far 141 out of 613 tests are successfully completed) are noted.

When creating the rust-coreutils package, it was decided not to replace the coreutils package, but to allow them to work in parallel. Rust utility options are installed in /usr/lib/cargo/bin/ and activated by adding this directory to the PATH environment variable. Creating the rust-coreutils package made it difficult to download all build dependencies into the repository, including Rust and various smaller crate packages.

Creating the boot image was no problem, but customizing the packages for the rust-coreutils environment was a lot of work, as many post-install scripts call utilities from the coreutils suite. The greatest number of problems were caused by the lack of necessary options, for example, the β€œ-archive” and β€œ--no-dereference” options were missing in the β€œcp” utility, β€œ-relative” option was not supported in β€œln”, mktemp - β€œ-t” , in sync "-fs", in install - "--owner" and "--group". Other issues surfaced due to differences in behavior, such as the install utility not supporting /dev/null as an input file, mkdir having a --parents option instead of "--parent", and so on.

When testing the assembly of large codebases, there were no big problems. When building Firefox and LLVM/Clang, python scripts and cmake are used, so replacing coreutils did not affect them. The build of the Linux kernel went relatively smoothly, with only two problems that surfaced: an error when using chown with a symbolic link, and the lack of the "-n" option in the ln utility.

Source: opennet.ru

Add a comment