Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's amazing the number of people that thing shell scripts should be anything other than throwaway single-person hacks.

They should probably go through their whole system and verify that there aren't more shell scripts being used, e.g. in the init system. Ideally a default distro would have zero shell scripts.





I can't tell whether you're making a joke, seeing as the entire BSD init system is built on shell scripts.

Probably not a joke. In the same way people want to get away from the C language due to its propensity to memory vulnerabilities, shell scripts have their own share of footguns, the most common being a variable not being quoted when it should (which is exactly the issue described in this advisory).

It doesn't mean getting away from scripting languages; it means getting away from shell scripts in particular (the parent poster said specifically "zero shell scripts"). If the script in question was written in Lua, or heck even Javascript, this particular issue most probably wouldn't have happened, since these scripting languages do not require the programmer to manually quote every single variable use.


That's fine; I just thought it was weird to say that we should check to see whether any shell scripts are used in the BSD init system. We know there are; it was a deliberate design decision at the time, even if we might now wish for it to be different.

Not a joke. I knew they used to use a pile of janky shell scripts for their init system. I didn't know they still do. That's disappointing.

And cesarb is correct - the issue isn't scripts; it's shell scripts, especially Bash and similar. Something like Deno/Typescript would be a decent option for example. Nushell is probably acceptable.

Even Python - while a terrible choice - is a better option than shell scripts.


The issue is POSIX standardizing legacy stuff like shells, thereby tempting people to write "portable" software, leading these technologies to ossify and stick with us for half a century and counting. Someone comes along and builds something better but gets threatened for not following "the UNIX way".

This is a very good point. I wonder how hard it would be to get POSIX to standardise a scripting language that isn't awful.

Probably never going to happen. There is a dearth of good scripting languages, and I would imagine any POSIX committee is like 98% greybeard naysayers who think 70s Unix was the pinnacle of computing.


POSIX does not specify the init/rc script system, so it's not a factor here at all. A POSIX-compliant system could use Python scripts. macOS (which is UNIX 03 certified) uses launchd. A POSIX system has to ship the shell, not use it.

And FreeBSD isn't actually POSIX-certified anyway!

The real consideration here is simply that there are tons of existing rc scripts for BSDs, and switching them all would be a large task.


Unfortunately your joke has wooshed over quite a few heads but what you say is true. The shell should be one of the most reliable parts of your operating system. Why on earth would you NOT trust the primary interface of your OS? Makes no sense.

The shell itself may be reliable but shell scripts are notorious for security issues.

I'm not sure I follow you but it wasn't a joke. Shell scripts are notoriously error-prone. I absolutely do not trust shell script authors to get everything right.

Also the shell isn't even "the primary interface of your OS". For Linux that's the Linux ABI, or arguably libc.

Unless you meant "human interface", in which case also no - KDE is the primary interface of my OS.


> I'm not sure I follow you but it wasn't a joke. Shell scripts are notoriously error-prone. I absolutely do not trust shell script authors to get everything right.

This is an extremely naive take as are the rest of your comments. Any language in the wrong hands is error prone.


> Any language in the wrong hands is error prone.

Talk about naive!


Feel free to implement system utilities in whichever language you feel will completely eliminate the possibility of bugs.

I wait with bated breath.


"error-prone" means bugs are more likely than the alternatives. It doesn't mean that the alternatives completely eliminate the possibility of bugs. Come on.

I wonder what the tally is for "things posted to HN that'll replace bash/ksh/zsh in every respect REAL Soon Now". It's a genre of post unto itself.

What language is Systemd written in? I'm pretty sure it's not Bash.

I've never been able to use systemd as a command interpreter.

You are being downvoted, but I agree with you.

I've always believed sh, csh, bash, etc, are very bad programming languages that require excessive efforts to learn how to write code in without unintentionally introducing bugs, including security holes.


Sir, this is a Wendy's.

If you want all-singing, all-dancing opaque binaries to handle every conceivable configuration eventuality, MacOS and Windows are <-- that way. Or, you could have patience, and sometime soon systemd will likely expand to cover your use-case.


On MacOS I remember many .plist files but no binary config files. The .plist format looks similar to XML.

I like the .ini format used by systemd (and do not have an opinion about the overall quality of systemd).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: