diff mbox series

[2/2] udev-extraconf: Avoid slashes in mountpoint names

Message ID 20251002095925.2521779-3-rtie@gmx.de
State New
Headers show
Series udev-extraconf: Speed up automounter and make it safer | expand

Commit Message

Robert Tiemann Oct. 2, 2025, 9:59 a.m. UTC
Devices with labels such as "Hello/World/Foo/Bar" cause mount.sh to
create the directory structure @MOUNT_BASE@/Hello/World/Foo/Bar. The
partition is mounted to the nested "Bar" directory. On device removal,
the directory structure is not cleaned up.

This commit replaces all forward slashes in partition labels by
underscores to avoid this edge case.

Signed-off-by: Robert Tiemann <rtie@gmx.de>
---
 meta/recipes-core/udev/udev-extraconf/mount.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/meta/recipes-core/udev/udev-extraconf/mount.sh b/meta/recipes-core/udev/udev-extraconf/mount.sh
index fe78f3aba5..4827779e2f 100644
--- a/meta/recipes-core/udev/udev-extraconf/mount.sh
+++ b/meta/recipes-core/udev/udev-extraconf/mount.sh
@@ -178,7 +178,7 @@  rm_dir() {
 
 get_label_name() {
 	# Get the LABEL or PARTLABEL
-	LABEL=`/sbin/blkid "$1" | grep -o 'LABEL=".*"' | cut -d '"' -f2`
+	LABEL=`/sbin/blkid "$1" | grep -o 'LABEL=".*"' | cut -d '"' -f2 | sed 's,/,_,g'`
 	# If the $DEVNAME has a LABEL or a PARTLABEL
 	if [ -n "$LABEL" ]; then
 	        # Set the mount location dir name to LABEL appended