Skip to content

Commit 14cb4ad

Browse files
committed
kernel_debug_files.sh: don't exit immediately if finding one file fails
Also fix the grep syntax.
1 parent fd10906 commit 14cb4ad

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

scripts/kernel_debug_files.sh

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ if [ $# -ne 0 ]; then
3838
usage err
3939
fi
4040

41+
status=0
42+
4143
release="$(uname -r)"
4244

4345
found_vmlinux=
@@ -54,11 +56,14 @@ for path in "/usr/lib/debug/boot/vmlinux-$release" \
5456
done
5557
if [ -z "$found_vmlinux" ]; then
5658
echo "vmlinux not found" >&2
57-
exit 1
59+
status=1
5860
fi
5961

60-
cut -d' ' -f1 /proc/modules | while read -r module; do
61-
module_path="$(modinfo -F filename "$module")"
62+
while read -r module _; do
63+
if ! module_path="$(modinfo -F filename "$module")"; then
64+
status=1
65+
continue
66+
fi
6267

6368
case "$module_path" in
6469
*.ko.gz)
@@ -81,11 +86,13 @@ cut -d' ' -f1 /proc/modules | while read -r module; do
8186
fi
8287
done
8388
if [ -z "$found_module" ]; then
84-
if eu-readelf -S "$module_path" | grep -q '\.z?debug_info'; then
89+
if eu-readelf -S "$module_path" | grep -q '\.z\?debug_info'; then
8590
echo "$module_path"
8691
else
87-
echo "debug info for $module not found"
88-
exit 1
92+
echo "debug info for $module not found" >&2
93+
status=1
8994
fi
9095
fi
91-
done
96+
done < /proc/modules
97+
98+
exit $status

0 commit comments

Comments
 (0)