The https://invent.kde.org/kdevelop/kdevelop/-/blob/20f2294e0fdfa2c2451a816360a5960887d8cf05/kdevplatform/util/kdevplatform_shell_environment.sh script has the `#!/bin/sh` shebang, so it should be a POSIX-compliant script. With a test using `checkbashisms` tool I found that it uses a lot of bashisms (features of bash that are not POSIX-compliant): Please ether use the `#!/bin/bash` shebang or fix the script to be POSIX-compliant.
Which commonly used shell the script does not support? The last commit that changed that script made it compatible with zsh. Is there a shebang that indicates both bash and zsh are supported?
(In reply to Igor Kushnir from comment #1) > Which commonly used shell the script does not support? > > The last commit that changed that script made it compatible with zsh. Is > there a shebang that indicates both bash and zsh are supported? For example the Debian Almquist shell (DASH) is a very POSIX-compliant shell, so it doesn't support any additional things like in `zsh` and `bash`. As I know it is the default shell for `/bin/sh` in both debian and ubuntu: - https://wiki.ubuntu.com/DashAsBinSh - https://en.wikipedia.org/wiki/Debian_Almquist_shell#Adoption_in_Debian_and_Ubuntu so it will cause problems at least in those two distros. The `bash` and `zsh` shells are POSIX-compatible so if the script is made to be POSIX-compliant it should also work in `bash` and `zsh` without problems. I don't think that there is a shebang for both zsh and bash, but if you don't want to be POSIX-compliant maybe you can create another POSIX-compliant shell script to select between zsh and bash then use the script as the shebang.
Is this bug report "it doesn't work in Debian and Ubuntu as-is", or is it "my linter says it might not work in Debian and Ubuntu as-is"?
(In reply to Sven Brauch from comment #3) > Is this bug report "it doesn't work in Debian and Ubuntu as-is", or is it > "my linter says it might not work in Debian and Ubuntu as-is"? It is a report about using `#!/bin/sh` shebang in a non POSIX-compliant script, which should be a bug by it self, since `#!/bin/sh` should be only used in POSIX-compliant scripts. I did use a linter in my whole /usr/bin directory to check if I can use the `dash` shell as my default shell, and I found this script using things like `if [[ "$1" == "" ]]` rather then `if [ "$1" = "" ]`. I know that this command will not work in the `dash` shell and I tested it, so it's not just a warning from the linter. I didn't test it in Ubuntu or Debian, but if the `dash` shell is used it will give a `dash: 1: [[: not found` error for this test statement.
The script in question kdevplatform_shell_environment.sh is called only by another script kdevelop! in https://invent.kde.org/kdevelop/kdevelop/-/tree/master/app This other script *is* POSIX-compliant I think, and it executes kdevplatform_shell_environment.sh either in zsh or in bash. So I expect the wrong shebang in kdevplatform_shell_environment.sh won't cause problems to KDevelop users. On the other hand, reverting it to `#!/bin/bash` should also be fine, I think. Or would it somehow work worse for zsh users?
(In reply to Igor Kushnir from comment #5) > Or would it somehow work worse for zsh users? No, it should not be a problem for zsh users.