Re: [PATCH v2 net-next] selftests/net: change shebang to bash to support "source"

From: Przemek Kitszel
Date: Fri Dec 29 2023 - 10:20:05 EST


On 12/29/23 14:19, Yujie Liu wrote:
The patch set [1] added a general lib.sh in net selftests, and converted
several test scripts to source the lib.sh.

unicast_extensions.sh (converted in [1]) and pmtu.sh (converted in [2])
have a /bin/sh shebang which may point to various shells in different
distributions, but "source" is only available in some of them. For
example, "source" is a built-it function in bash, but it cannot be
used in dash.

Refer to other scripts that were converted together, simply change the
shebang to bash to fix the following issues when the default /bin/sh
points to other shells.


(snip)


Link: https://lore.kernel.org/all/20231202020110.362433-1-liuhangbin@xxxxxxxxx/ [1]
Link: https://lore.kernel.org/all/20231219094856.1740079-1-liuhangbin@xxxxxxxxx/ [2]
Reported-by: kernel test robot <oliver.sang@xxxxxxxxx>
Signed-off-by: Yujie Liu <yujie.liu@xxxxxxxxx>

I would recommend use of shellcheck in the future, it will catch this
particular bug, with following warning:
SC3046: In POSIX sh, 'source' in place of '.' is undefined.

Being specific, and requiring bash looks fine for me.

Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@xxxxxxxxx>