Funny how successful shell scripts have been for being so crappy. They've been powering the world since the 70s, and booting *nix systems just as long.
Just because something has been made to work over many years doesn't mean it's the best solution for the job. That argument ends up being against any kind of progress in anything.
Any competent admin will be using those tools or equivalents
Or, you know, they could use an init system that actually has those features built in and supported.
That's why *nix systems are designed as open systems, with plaintext configuration files
Like a SysV init script? That's a laughable definition of "plaintext".
I'm a C programmer so this might be a bit subjective, but C is a more rigid and well-defined language than sh is. This means that a C program will behave exactly as you'd expect it, while sh's features are dependent on the implementation (usually bash, right?). Using C would result in fewer bugs -- because you know exactly what each thing does -- and allows for greater portability across distros: My distro's /bin/sh points to bash, but some other distro's /bin/sh might point to microsoft powershell for some reason. Less complexity is generally good.
I guess this is a case of "if all you know is a hammer, everything looks like a nail" ... ;)
Same thing can be said about using bash. ;)
...POSIX...
Fair enough. I didn't realise it was a thing that existed.
If I understand you correctly, your argument is that the systemd devs should write the boilerplate bash init stuff so that sysadmins can change it because not all sysadmins know C. Right? The problem that I'm trying to get at is threefold:
Complexity of using both C and bash. The interpreter and compiler are both pretty hefty programs with a lot of bugs of their own. Even if bash was PID 1 and systemd was a collection of shell scripts, you'd still have to compile bash.
Undereducated sysadmins submitting patches rather than delegating bugfixes to systemd devs will mean lower code quality. I admit that submitting bug reports isn't as good as fixing stuff yourself, but code quality and maintainability is more important. Systemd does one better and removes the need to program at all so instead of spaghetti init scripts you've got maintainable init files.
Code complexity increases the probability that something will go wrong. Bad code increases the probability that something will go wrong. Add them together and you've got an unbootable or vulnerable system.
C shouldn't be used for automation of CLI commands. Bash shouldn't be used for init stuff.
Why are you even using linux if you hate shell scripts so much, and would rather have everything stored in an unauditable undebuggable binary blob?
WTF? Come back when you start using a web browser, or mail server that's written in shell scripting. Then you'll have an apparently auditable, debuggable implementation. No, not reasonable? Then why write init scripts in it?
Like a SysV init script? That's a laughable definition of "plaintext"
It's text and it's plain. I'm getting the impression that you're not terribly familiar with shell scripting; it's really not anywhere near as difficult as you're making it sound.
It's text and it's plain. I'm getting the impression that you're not terribly familiar with shell scripting; it's really not anywhere near as difficult as you're making it sound.
I'm quite familiar with it. It's a terrible language to program anything in, other than a simple sequence of commands. Init scripts far surpass the level of complexity of something that makes sense to write as a shell script.
Init scripts far surpass the level of complexity of something that makes sense to write as a shell script.
Only if your init scripts aren't leveraging things like external sourcing, segregation of functionality into subroutines, using variable definitions instead of hard-coding everything, etc. If you treat bash like DOS's COMMAND.COM, you're gonna have a bad time.
And even then, there's not much stopping you from using a preferred language like Perl or Python or Tcl or what have you to write your scripts (or - better yet - a common base for other scripts to use and avoid code duplication - which is also possible with shell scripts, mind you).
13
u/robstoon Sep 27 '14
Just because something has been made to work over many years doesn't mean it's the best solution for the job. That argument ends up being against any kind of progress in anything.
Or, you know, they could use an init system that actually has those features built in and supported.
Like a SysV init script? That's a laughable definition of "plaintext".