Skip to content

Commit c1c8153

Browse files
committed
hw-mgmgt: scripts: Fix generate dump failed on sys folder.
In case of simlink contains special characters (spaces/parentheses) generate debug dump can fail. It happens because command "ls -Rla /sys/" fails when encountering symlinks that contains special characters (example in Marvell driver names). Fix: Use "find" command instead of "ls" Bug: 4828481 Signed-off-by: Oleksandr Shamray <oleksandrs@nvidia.com>
1 parent fbe597a commit c1c8153

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

usr/usr/bin/hw-management-generate-dump.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22
##################################################################################
33
# SPDX-FileCopyrightText: NVIDIA CORPORATION & AFFILIATES
4-
# Copyright (c) 2020-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
4+
# Copyright (c) 2020-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
55
#
66
# Redistribution and use in source and binary forms, with or without
77
# modification, are permitted provided that the following conditions are met:
@@ -74,7 +74,9 @@ fi
7474

7575
dump_cmd "sensors" "sensors" "20"
7676

77-
ls -Rla /sys/ > $DUMP_FOLDER/sysfs_tree
77+
# Use find to handle symlinks with special characters (exclude /sys/kernel/)
78+
find /sys/ -path '/sys/kernel' -prune -o -ls > $DUMP_FOLDER/sysfs_tree 2>&1
79+
7880
if [ -d $HW_MGMT_FOLDER ]; then
7981
ls -Rla $HW_MGMT_FOLDER > $DUMP_FOLDER/hw-management_tree
8082
timeout 140 find -L $HW_MGMT_FOLDER -maxdepth 4 ! -name '*_info' ! -name '*_eeprom' -exec ls -la {} \; -exec cat {} \; > $DUMP_FOLDER/hw-management_val 2> /dev/null

0 commit comments

Comments
 (0)