linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Starting helper programs - explicit check instead of just adding
@ 2007-03-29  7:49 Matthias Schwarzott
  2007-03-29 11:59 ` Kay Sievers
  0 siblings, 1 reply; 2+ messages in thread
From: Matthias Schwarzott @ 2007-03-29  7:49 UTC (permalink / raw)
  To: linux-hotplug

Hi there!

Generally executing udev-helper programs located in /lib/udev works well 
(without specifying a path).
Only one rule I use, just does not work like one could think:

SUBSYSTEM="pnp", ENV{MODALIAS}!="?*", RUN+="/bin/sh -c 'while read id; 
do /lib/udev/modprobe.sh pnp:d$$id; done < /sys$devpath/id'"

Here I have to explicitly give the full path to modprobe.sh.

The code uses this to look for not fully qualified pathes:
if (strchr(argv[0], '/') = NULL) {
                strlcpy(program, "/lib/udev/", sizeof(program));
                strlcat(program, argv[0], sizeof(program));
                argv[0] = program;
        }
...
execv(argv[0], argv);

And that only looks at the main program started in the cmd-line and not what 
this shell does.

Is this something that could be changed?
By e.g. using some exec-call respecting path?
Or keeping the code as it is, but still adding /lib/udev to PATH for such 
embedded calls to work like one could assume with common-sense?

Matthias

-- 
Matthias Schwarzott (zzam)

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Starting helper programs - explicit check instead of just adding
  2007-03-29  7:49 Starting helper programs - explicit check instead of just adding Matthias Schwarzott
@ 2007-03-29 11:59 ` Kay Sievers
  0 siblings, 0 replies; 2+ messages in thread
From: Kay Sievers @ 2007-03-29 11:59 UTC (permalink / raw)
  To: linux-hotplug

On 3/29/07, Matthias Schwarzott <zzam@gentoo.org> wrote:
> Generally executing udev-helper programs located in /lib/udev works well
> (without specifying a path).
> Only one rule I use, just does not work like one could think:
>
> SUBSYSTEM="pnp", ENV{MODALIAS}!="?*", RUN+="/bin/sh -c 'while read id;
> do /lib/udev/modprobe.sh pnp:d$$id; done < /sys$devpath/id'"
>
> Here I have to explicitly give the full path to modprobe.sh.

> And that only looks at the main program started in the cmd-line and not what
> this shell does.
>
> Is this something that could be changed?
> By e.g. using some exec-call respecting path?
> Or keeping the code as it is, but still adding /lib/udev to PATH for such
> embedded calls to work like one could assume with common-sense?

It's the expected behavior, we don't want to stat() all over the
place, to find the programs.
You can set the path with:
  ENV{PATH}="/lib/udev:/bin:/sbin"
in any earlier rule, and the udev-forked shell will find all the
commands in /lib/udev.

Thanks,
Kay

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-03-29 11:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-29  7:49 Starting helper programs - explicit check instead of just adding Matthias Schwarzott
2007-03-29 11:59 ` Kay Sievers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).