Skip to main content
Topic: runit systems will break if using dash as is (Read 104 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

runit systems will break if using dash as is

I use the runit version and I also use dash as my default shell for the minor speed boost. Unfortunately one of the postinstall hook scripts is mislabelled as a shell script despite having bashisms and the system become ubootable for dash/runit users like me:

Running post-transaction hooks...
(1/2) Detecting init ...
/usr/share/libalpm/scripts/initswitch-hook: 12: [[: not found
/usr/share/libalpm/scripts/initswitch-hook: 14: [[: not found
/usr/share/libalpm/scripts/initswitch-hook: 16: [[: not found
/usr/share/libalpm/scripts/initswitch-hook: 19: [[: not found

This happened in an update several months  and then again a couple days ago.

Replacing the [[ ]] with single brackets or marking the script as /bin/bash would solve the problem. As it is, the script will erroneously think runit systems are openrc systems and will make them unbootable.

If anyone else sees this error, you can actually just run pacman -S runit and the runit post-install hooks will fix the issue for you.

That's it. I wasn't 100% sure where to open a PR hence a forum post, but that's the fix. I'm sure others have run into this problem.

Re: runit systems will break if using dash as is

Reply #1
Seems reasonable. I'd lean towards marking it as a bash script (every artix linux install has bash after all).

Re: runit systems will break if using dash as is

Reply #2
It's not my decision to make, but just using [ ] would probably be abstractly preferable as a nit-pick. There's not really a reason to invoke bash when posix-compliant shell will do. The [[ ]] aren't actually used for regex matching or any of their added features so there's no harm in replacing them with [ ] and keeping it as a /bin/sh script.

Of course it's all immaterial because the any performance gains in allowing the script to use sh rather than bash would be inconsequential, but it's just the principle of the thing.

 

Re: runit systems will break if using dash as is

Reply #3
Artoo ended up making it [ ] after all. Should be fixed in testing. Thanks for the report!