by codedokode · 4y ago · 0 comments
Its creators probably tried their best to write it, gave functions good names, left comments sometimes, but still it was bad. Running several subprocesses to split a string into parts. Parsing text output of subprocesses. Creating unnecessary temporary files.
This style of programming leads to extremely fragile systems. If the command slightly changes its output, scripts will break. If the command output depends on locale, scripts will break.
Futhermore, there is no sane options for error handling in shell scripts. There is only a relatively sane option - crash on any error and an insane option - ignore any erros and continue. For example, we failed to backup a file, but ignore this error and delete the original. No way one can write something reliable using such tools.
So if you want to write an init system, I think there are better languages that a shell script. It is difficult to build a graph of services and find an optimal sequence to start them using shell scripts. Or implement lazy startup of non-critical services.
Init system is not only a program to boot the system, but it should provide some runtime services, like management of background processes, logins and other things. Again, a properly written daemon with an API is better than a bunch of shell scripts.
Regarding languages, I am not sure if C is good for this purpose, it's pretty awful too. To illustrate this, consider a C function declaration:
int set_working_directory(char *new_directory, char **error);
You cannot figure out how to call this function properly without documentation or examining the code.
Instead of C I would choose something like Swift, D, Go (but it has pointers), maybe Rust (but writing in Rust for me is mostly struggling against borrow checker). I would choose something that's easy to read, test and verify and has a package manager.
So if you don't like systemd, consider writing your init system using one of the languages above. But please don't use shell scripts anymore.
It looks like an example of corporate bullying vs. open-source community and the corporate won.
It’s like claiming that kde-plasma is bloated because it has everything even a video editor under the namespace.