> 2025年1月22日 21:26,Mariusz Tkaczyk <mtkaczyk@xxxxxxxxxx> 写道: > > On Wed, 22 Jan 2025 20:43:19 +0800 > Coly Li <colyli@xxxxxxx> wrote: >> [snipped] >> So the patch is just a best-effort-try, if the binary is not >> installed in /sbin, /usr/sbin or /usr/local/sbin, my patch just gives >> up. >> > > Maybe we can print error then? It would be useful for programmers > to understand the problem. Sometimes, to debug early stages I simply > redirected all error messages from mdadm to /dev/kmsg. > Currently there is error message: sh: modprobe: command not found. This message was caught from console and this was how the root cause was found. This might be enough? > >>> >>>> + >>>> if (system("modprobe md_mod") == 0) >>>> fd = open(new_array_file, O_WRONLY); >>> >>>> } >>> >>> The change will affect code executed later, probably we don't want >>> that. Shouldn't we restore old PATH here to minimize risk? >> >> For my understanding if the code was called after boot up, these path >> should be set already by shell initialization scripts. And for udev >> context, it is called and exited, and NOT shared with other udev >> tasks, almost no influence. > > I see, it is more theoretical problem, almost to possible to met. > All fine then, we can continue with no clean up here as I cannot find > normal scenario it can occur. > > Your change (after getenv fixes) LGTM. You can take a look into concept > I proposed but I have no strong preference. Copied. V3 posted. Thanks. Coly Li