On 05/11/2011 04:09 PM, Harald Becker wrote:
  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

--
Harald
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Agreed. I think having a standard set of environment variables (even if it's a slightly larger set than MDEV and SUBSYSTEM) would be valuable to developers and would reduce the amount of work to "reinvent the wheel" so-to-speak everytime for those that use scripts. I can help anyone who can code a patch on where to locate some of this information within sysfs, however, this will result in mdev having an increasing dependence on it.

Thanks again Harald for your continued help!

Dave
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to