Ferk / udev-media-automount

A simple automount mechanism using udev rules
Other
125 stars 59 forks source link

media-automount ignores devices if their label matches mount point in fstab #25

Open lmoellendorf opened 8 months ago

lmoellendorf commented 8 months ago

Steps to reproduce

1) Format an USB thumb drive and set volume name:

mkfs.vfat -n data /dev/sda1

2) Add a line to your /etc/fstab containing the label as mount point, e.g.:

/dev/mmcblk0p3       /data                auto       defaults              0  2

3) Insert the thumb drive

Expected result

Thumb drive should be mounted.

Actual result

Thumb drive is ignored:

 /dev/sda1 already in /etc/fstab, automount won't manage it: /dev/mmcblk0p3       /data                auto       defaults              0  2

Possible fix

In line 78 LABEL is used to find devices in fstab.

If the regex is changed to not allow spaces before ${LABEL} it will ignore mount points:

LABEL=data; grep /etc/fstab -e "^[^# ]*${LABEL}"
LABEL=mmcblk0p3; grep /etc/fstab -e "^[^# ]*${LABEL}"
/dev/mmcblk0p3       /data                auto       defaults              0  2

But I am not aware what possible values have to be matched in fstab.