bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Cooker] strange problem with "hotplug" package


From: Andrey Borzenkov
Subject: Re: [Cooker] strange problem with "hotplug" package
Date: Tue, 06 May 2003 17:45:40 +0400

> 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 ??

address@hidden grep -q bor /etc/passwd <&- >&-
grep: write error: Bad file descriptor
address@hidden 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.


address@hidden 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
address@hidden rpm -q hotplug grep
hotplug-2002_04_01-2mdk
grep-2.5-5mdk


-andrey




reply via email to

[Prev in Thread] Current Thread [Next in Thread]