From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Andrey Borzenkov" Date: Tue, 06 May 2003 13:45:40 +0000 Subject: Re: [Cooker] strange problem with "hotplug" package Message-Id: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org > 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