mdev with hda's

Harald Becker ralda at
Wed May 11 20:09:25 UTC 2011

 Hallo David!

> Realizing this now, I think the PATH variable should be added to the
> "standard" set of variables as part of the mdev environment.  However,
> this value would need to be passed by the actual shell PATH and not a
> pre-defined one from mdev.  I noticed that this was the case while
> running tests over the last couple of days.

mdev calls /bin/sh to execute the commands specified in mdev.conf. In
such situations it is good and well known practice to set PATH to the
required value at start of the script. The only other default would be
to use the default path (/bin:/sbin:/usr/bin:/usr/sbin) when calling
helper scripts. That could be a wise decision for mdev. No other value
of PATH is reliable at this point, as it has been revealed that mdev
itself has no direct access to a reliable parent environment.

To summarize (as I see it now):

Your question about insane environment setting of mdev is based on the
wrong assumtion, that mdev reliable propagates the values you are
seeking for into environment variables, as udev may do. Currently mdev
exports only MDEV and SUBSYSTEM (where only MDEV is documented). No
other variables shall be expected to hold any reliable value within
helper scripts. That is the answer based on current mdev implementation.

... but you are right, that it could be a good decision to extend the
functionality of mdev to export more informations to helper scripts via
environment variables. At least the values of MAJOR, MINOR and DEVPATH
shall be accessible within mdev at the point of script invocation
(assumption based on my short dig into mdev source). Beside this setting
of PATH to a default value would be wise, and additionally clearing out
the rest of the environment for helper scripts could be a good decision
and will help to avoid confusion like David's ... IMHO


More information about the busybox mailing list