On Wed, 22 Jan 2025 23:18:59 +0800 Coly Li <colyli@xxxxxxx> wrote: > During the boot process if mdadm is called in udev context, sbin paths > like /sbin, /usr/sbin, /usr/local/sbin normally not defined in PATH > env variable, calling system("modprobe md_mod") in > create_named_array() may fail with 'sh: modprobe: command not found' > error message. > > We don't want to move modprobe binary into udev private directory, so > setting the PATH env is a more proper method to avoid the above issue. > > This patch sets PATH env variable with > "/sbin:/usr/sbin:/usr/local/sbin" before calling system("modprobe > md_mod"). The change only takes effect within the udev worker > context, not seen by global udev environment. > > Signed-off-by: Coly Li <colyli@xxxxxxx> > --- > Changelog, > v3, check return value of getenv(). > v2: set buf[PATH_MAX] to 0 in stack variable announcement. > v1: the original version. > Applied! Thanks, Mariusz