Re: [PATCH v1 1/1] selftests/cpu-hotplug: Make the script complaint with sh shell

From: Hubert Mazur

Date: Wed Apr 01 2026 - 08:22:17 EST


On Tue, Mar 31, 2026 at 11:52 PM Shuah Khan <skhan@xxxxxxxxxxxxxxxxxxx> wrote:
>
> On 3/18/26 02:08, Hubert Mazur wrote:
> > The script uses by default the bash shell that is inaccessible in
> > the x86 embedded devices. This leads to the syntax errors. To mitigate
>
> some x86 embedded devices - which ones?
Actually - this isn't particularly accurate since it applies to any devices
which rely on busybox or other small environments.

> > this, change the interpreter to /bin/sh and properly assign the
> > FUNCNAME variable for each of the functions as 'sh' doesn't set this
> > env. Change the conditional check for being a root from not
> > existent UID and replace with command execution "id -u".
>
> Please include errors in the change log
The first error comes from the "$UID" environment variable,
and the error is:
./cpu-on-off-test.sh[193]: [: 0: unexpected operator/operand

Regarding the changes to "$FUNCNAME" - there's no error printed
but also the function name is missing in print:
"echo $FUNCNAME $cpu: unexpected success >&2"

The v1 already addresses the most urgent issues with $UID and $FUNCNAME
which I faced but in the meantime I took a look at the sashiko.dev review tool:
https://sashiko.dev/#/patchset/20260318080825.3063959-2-hmazur%40google.com

and uploaded v2 patch which addresses other issues reported by the tool:
https://lore.kernel.org/all/20260331115111.1522473-1-hmazur@xxxxxxxxxx/

Please let me know if I should revert to v1 and update the changelog
and commit message or we can continue with v2.

Regards
Hubert