Hi,

I just identifed a bug in /etc/hotplug.d/usb/01-mount (FreeWRT-HEAD).

I plugged in a USB harddisk. This creates this structure in /dev/disks:

r...@freewrt:/dev/discs # find /dev/discs -follow
/dev/discs
/dev/discs/disc0
/dev/discs/disc0/disc
/dev/discs/disc1
/dev/discs/disc1/disc
/dev/discs/disc1/part1

After the mentioned script is run I have 2 mountpoints:

# ls -l /mnt
drwxr-xr-x    1 root     root            0 Jan  1 01:03 disc0_*
drwxr-xr-x    7 root     root        32768 Jan  1  1970 disc1_1

The first one is pretty funny. A directory entry named "disk0_*". After doing 
some investigation I found this in 01-mount:

        cd $dev
        for part in part*; do
                                        path=/mnt/${dev}_${part##*part}
                                        mkdir -p ${path}
                                        mount ${part} ${path}
        done

This for-loop uses "part*" as a pattern in directory /dev/discs/disk0, which 
has no entry, which matches the pattern. The result is, that the loop is run 
once with part set to "part*", which is converted th the seen directory 
entry "disk0_*".

If someone knows a elegant fix for this, go on please. I can fix it, but I 
have no elegant way to do it. Maybe the most simple one is just to check that 
special case like:

        cd $dev
        for part in part*; do
                [ "$part" ne "part*" ] && {
                                        path=/mnt/${dev}_${part##*part}
                                        mkdir -p ${path}
                                        mount ${part} ${path}
                }
        done


Tommi
_______________________________________________
freewrt-developers mailing list
[email protected]
https://www.freewrt.org/lists/listinfo/freewrt-developers

Reply via email to