wpa_supplicant can't run in zsh/sh default shell
ayoubelmhamdi opened this issue · 4 comments
I found a bug in the config file of the service named wpa_supplicant
, when using some shell, like sh
or zsh
instead of bash
for the root
user
$ cat /etc/passwd
root:x:0:0:root:/root:/bin/zsh
this error is in this file : /etc/sv/wpa_supplicant/auto
- Because in bash, we can find in two directories like that
for f in /etc/wpa_supplicant/wpa_supplicant-*.conf /etc/wpa_supplicant-*.conf ;
do
#....
done
but we can't do it in another shell
- my
PR
is changing thisfor-loop
or addingbash shebang
,
***but can't find Void-Linux source in GitHub*** or where is this file :
/etc/sv/wpa_supplicant/auto` send a pull request to fix it
The root shell does not matter the run script has a /bin/sh
shebang. This should also work in all shells that are somewhat posix compliant, this includes zsh. POSIX shell for loops just take a number of words and loop through them, the patterns are expanded earlier and generally behave like arguments for a normal command.
The file is in https://github.com/void-linux/void-packages/blob/master/srcpkgs/wpa_supplicant/files/wpa_supplicant/auto, but I don't see a reason to change it.
I believe this issue isn't an issue.
Can you please confirm, @ayoubelmhamdi ?
The root shell does not matter the run script has a
/bin/sh
shebang. This should also work in all shells that are somewhat posix compliant, this includes zsh. POSIX shell for loops just take a number of words and loop through them, the patterns are expanded earlier and generally behave like arguments for a normal command.
- in zsh:
$ for f in /etc/wpa_supplicant/wpa_supplicant-*.conf /etc/wpa_supplicant-*.conf ; do echo $f;done
zsh: no matches found: /etc/wpa_supplicant-*.conf
- in bash:
$ for f in /etc/wpa_supplicant/wpa_supplicant-*.conf /etc/wpa_supplicant-*.conf ; do echo $f;done
/etc/wpa_supplicant/wpa_supplicant-wlan0.conf
/etc/wpa_supplicant-*.conf
Ok so it doesn't work in zsh, but we are not using zsh for that anyways, so I don't really see what the issue is here. Changing the root shell does not make it execute zsh as /bin/sh and using a shell that is not posix compliant as /bin/sh is simply not supported.
Also if zsh would be invoked as /bin/sh
it works as expected:
~$ chpst -b /bin/sh zsh -c 'for f in /etc/xbps.d/*.conf /sxds*; do echo $f; done'
/etc/xbps.d/00-repository-main.conf
/etc/xbps.d/10-apparmor.conf
/etc/xbps.d/10-ignore.conf
/sxds*