On a Debian-based distro /bin/sh resolves to dash which does not understand, for example, arrays.
Yet I see scripts - also in KDE - that use #!/bin/sh or #!/usr/bin/env sh but still use such bashisms.
One example from plasma-desktop would be kconf_update/50-krunner-activate-typing.sh which uses arrays and adjacent constructs.
I find it more likely that I’m misunderstanding something here than that 30 years of KDE somehow missed that. Or maybe it’s not a problem after all, IDK.
You actually guessed correctly. Someone wrote it, it caused no issues, nobody cared afterwards. If the script is using bashisms it can safely be changed to #!/usr/bin/env bash. That is a very simple contribution, fast to merge too if you show the ShellCheck output in the MR description itself and wait for the maintainer to confirm the same thing.
shellcheck 50-krunner-activate-typing.sh
In 50-krunner-activate-typing.sh line 43:
candidates=()
^-- SC3030 (warning): In POSIX sh, arrays are undefined.
In 50-krunner-activate-typing.sh line 45:
candidates+=("$HOME/.config/plasma-org.kde.plasma.desktop-appletsrc")
^--------^ SC3024 (warning): In POSIX sh, += is undefined.
^-- SC3030 (warning): In POSIX sh, arrays are undefined.
In 50-krunner-activate-typing.sh line 48:
candidates+=("${XDG_CONFIG_HOME}/plasma-org.kde.plasma.desktop-appletsrc")
^--------^ SC3024 (warning): In POSIX sh, += is undefined.
^-- SC3030 (warning): In POSIX sh, arrays are undefined.
In 50-krunner-activate-typing.sh line 53:
while IFS= read -r -d '' f; do
^-- SC3045 (warning): In POSIX sh, read -d is undefined.
In 50-krunner-activate-typing.sh line 54:
candidates+=("$f")
^--------^ SC3024 (warning): In POSIX sh, += is undefined.
^----^ SC3030 (warning): In POSIX sh, arrays are undefined.
In 50-krunner-activate-typing.sh line 55:
done < <(find "$SEARCH_DIR" -type f -name 'plasma-org.kde.plasma.desktop-appletsrc*' -print0 2>/dev/null)
^-- SC3001 (warning): In POSIX sh, process substitution is undefined.
For more information:
https://www.shellcheck.net/wiki/SC3001 -- In POSIX sh, process substitution...
https://www.shellcheck.net/wiki/SC3024 -- In POSIX sh, += is undefined.
https://www.shellcheck.net/wiki/SC3030 -- In POSIX sh, arrays are undefined.
In the /usr/share/kconf_update directory, it’s only this one script. And according to checkbashisms it’s the only directly KDE-related “wrong shebang”.
I’m guessing the github repo is not the correct place for this, but it leads me to this which tells me how to create an account on invent.kde.org.
On it.
Question:
What does this do? Will krunner break if I link /bin/sh to dash? Since that is the default on Debian-like systems, I’m guessing not?
# kconf update script to migrate users who previously disabled
# activateWhenTypingOnDesktop for KRunner. This script only flips
# users who explicitly set the key to "false" to "true" and
# leaves unset keys untouched.
You can’t merge your own merge requests without a developer account, which is something that has to be earned with time. Just be patient; someone will come along to review it soon I’m sure.
Yeah, that’s because you sent the merge request from the master branch of your fork, rather than a differently-named branch.
To resolve this, un-protect the master branch of your fork in the settings for it in invent.kde.org. That will let you (and also developers who want to merge it) rebase it and force-push to it.