[openwrt/openwrt] base-files: find_mmc_part: Silence error when no MMC exists

LEDE Commits lede-commits at lists.infradead.org
Sun Jul 27 09:09:24 PDT 2025


hauke pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/11aa0fc6fb9405c5aa6f8ea05759d5719c982a82

commit 11aa0fc6fb9405c5aa6f8ea05759d5719c982a82
Author: Andreas Gnau <andreas.gnau at iopsys.eu>
AuthorDate: Tue Jul 22 11:12:08 2025 +0200

    base-files: find_mmc_part: Silence error when no MMC exists
    
    When running find_mmc_part on a system without MMC or when the given
    root device does not exist, an error message is printed to stderr.
    
        grep: /sys/block/mmcblk*/mmcblk*p*/uevent: No such file or directory
    
    Silence this error message.
    
    Since find_mmc_part is mostly used to get block devices of MMC
    partitions and the negative result (partion not found) is checked for by
    the caller, the error message can be silenced without causing any
    negative impact.
    
    Signed-off-by: Andreas Gnau <andreas.gnau at iopsys.eu>
    Link: https://github.com/openwrt/openwrt/pull/19492
    Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 package/base-files/files/lib/functions.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/base-files/files/lib/functions.sh b/package/base-files/files/lib/functions.sh
index 18bf79251d..c1aeea7b72 100644
--- a/package/base-files/files/lib/functions.sh
+++ b/package/base-files/files/lib/functions.sh
@@ -447,7 +447,7 @@ find_mmc_part() {
 	fi
 
 	for DEVNAME in /sys/block/$ROOTDEV/mmcblk*p*; do
-		PARTNAME="$(grep PARTNAME ${DEVNAME}/uevent | cut -f2 -d'=')"
+		PARTNAME="$(grep PARTNAME ${DEVNAME}/uevent | cut -f2 -d'=' 2>/dev/null)"
 		[ "$PARTNAME" = "$1" ] && echo "/dev/$(basename $DEVNAME)" && return 0
 	done
 }




More information about the lede-commits mailing list