linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [Cooker] strange problem with "hotplug" package
@ 2003-05-06 13:45 Andrey Borzenkov
  2003-05-06 15:54 ` Stepan Kasal
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Andrey Borzenkov @ 2003-05-06 13:45 UTC (permalink / raw)
  To: linux-hotplug


> my situation below:
>  when i unplug my usb NIC and plug it back,
>  i found "ifplugd" running at my system.
>  and i have "MII_NOT_SUPPORTED=yes" at ifcfg-eth0,
>  so this souldn't be happened.
>  i trace the script /etc/hotplug/net.agent and
>  found that the "grep" command didn't work as expected.
>
>  i shrink the net.agent script as below:
>
>  #!/bin/bash
>  grep -q '^MII_NOT_SUPPORTED' /etc/sysconfig/network-scripts/ifcfg-eth0
>  echo $? > /tmp/grep_result
>
>  /tmp/grep_result is "0" when run script from command-line.(correct result)
>  /tmp/grep_result is "1" when i plug-in  my usb NIC. (wrong result!!)
>
>  i found if i add ">/dev/null" would solve the strange problem.
>  eg: fix first line to:
>  grep -q '^MII_NOT_SUPPORTED' /etc/sysconfig/network-scripts/ifcfg-eth0 >/dev/null

>  now /tmp/result would be "0" if i plug-in my usb NIC.
>  after fix the original net.agent, add ">/dev/null" to grep,
>  i solve my problem, ifplugd woun't start when i plug-in my usb NIC.
>  i found there are many "grep" at /etc/hotplug/* scripts.
>  maybe all these "grep" would suffer as mine.
>  i m curious what casue "grep" stop working without ">/dev/null".
>  anybody who can tell me ??

bor@cooker% grep -q bor /etc/passwd <&- >&-
grep: write error: Bad file descriptor
bor@cooker% echo $?
1

exec_usermodehelper closes all file descriptors so grep barfs.
Adding > /dev/null makes a valid stdout.

This is om Mandrake 9.0; you say it is on 9.1 ... well, this
definitely makes hotplug life harder. 

i wonder why grep would write to stdout with -q:

-q, --quiet, --silent
    Quiet;  do  not write anything to standard output.  Exit immedi-
    ately with zero status if any match is found, even if  an  error
    was detected.  Also see the -s or --no-messages option.


bor@cooker% uname -a
Linux cooker.mow.siemens.ru 2.4.20-2mdk #1 Mon Dec 9 15:07:53 CET 2002 i686 unknown unknown GNU/Linux
bor@cooker% rpm -q hotplug grep
hotplug-2002_04_01-2mdk
grep-2.5-5mdk


-andrey


-------------------------------------------------------
Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara
The only event dedicated to issues related to Linux enterprise solutions
www.enterpriselinuxforum.com 

_______________________________________________
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] 5+ messages in thread

end of thread, other threads:[~2003-05-08 16:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-06 13:45 [Cooker] strange problem with "hotplug" package Andrey Borzenkov
2003-05-06 15:54 ` Stepan Kasal
2003-05-06 20:12 ` Jim Meyering
2003-05-08 12:24 ` Stepan Kasal
2003-05-08 16:17 ` Jim Meyering

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).