:: Re: [DNG] vdev status update in dae…
Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: Ludovic Bellière
Fecha:  
A: dng
Asunto: Re: [DNG] vdev status update in daedalus
On Fri, 08 Dec 2023, aitor wrote:

>The origin of the bug was in the use of an asterisk in the regex `fd*` used in the helper `disk.sh` (line 57):
>
>https://github.com/jcnelson/vdev/blob/master/vdevd/helpers/LINUX/disk.sh:
>
>in order to skip inappropriate block devices.
>
>The piece of code responsible for that is:
>
>   # skip inappropriate block devices
>   if [ -n "$(echo "$VDEV_PATH" | /bin/egrep "fd*|mtd*|nbd*|gnbd*|btibm*|dm-*|md*|zram*|mmcblk[0-9]*rpmb")" ]; then
>      return 0
>   fi
>
>Indeed:
>
>$ echo "sdf" | egrep "fd*"
>sdf
>
>Which syntax would you suggest for this purpose?


The asterix means 0 or more. If you need to match 'd', then you want to use + (1
or more):

     echo "sdf" | grep -E 'fd+'


You'll want to change all asterix, probably. I case of doubt, you may want to
consult https://regex101.com.

Cheers,
                 Ludovic