[Unstable/Noble PATCH 1/2] UBUNTU: [packaging] do not use 'return' outside functions of shell script
Masahiro Yamada
masahiro.yamada at canonical.com
Fri Mar 1 08:25:52 UTC 2024
On Ubuntu, /bin/sh is a symlink to /bin/dash by default.
While this is a rare use case, when /bin/sh is a symlink to /bin/bash,
the annotation check fails due to a mismatch of CONFIG_UBUNTU_ODM_DRIVERS.
debian/scripts/misc/arch-has-odm-enabled.sh always fails with bash.
You can see it if you directly execute it.
[with dash]
$ dash debian/scripts/misc/arch-has-odm-enabled.sh amd64
cat: debian/scripts/misc/../../../debian.master/rules.d/hooks.mk: No such file or directory
$ echo $?
0
[with bash]
$ bash debian/scripts/misc/arch-has-odm-enabled.sh amd64
cat: debian/scripts/misc/../../../debian.master/rules.d/hooks.mk: No such file or directory
debian/scripts/misc/arch-has-odm-enabled.sh: line 26: return: can only `return' from a function or sourced script
$ echo $?
2
Bash provides stricter checks, hence the 'return' statement outside
a function leads to an error.
Replace or remove inappropriate 'return'.
Signed-off-by: Masahiro Yamada <masahiro.yamada at canonical.com>
---
debian/scripts/misc/arch-has-odm-enabled.sh | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/debian/scripts/misc/arch-has-odm-enabled.sh b/debian/scripts/misc/arch-has-odm-enabled.sh
index b812cc091983..b71e55620963 100755
--- a/debian/scripts/misc/arch-has-odm-enabled.sh
+++ b/debian/scripts/misc/arch-has-odm-enabled.sh
@@ -20,7 +20,5 @@ for f in $ARCH.mk hooks.mk; do
eval $(cat $RULESDIR/$f | sed -n -e '/do_odm_drivers/s/ \+//gp')
done
if [ "$do_odm_drivers" != "true" ]; then
- return 1
+ exit 1
fi
-
-return 0
--
2.40.1
More information about the kernel-team
mailing list