Bug 104788 - Strange "Broken pipe" from /sbin/service
Strange "Broken pipe" from /sbin/service
Status: CLOSED CURRENTRELEASE
Product: Red Hat Linux
Classification: Retired
Component: initscripts (Show other bugs)
9
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Bill Nottingham
Brock Organ
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-09-21 20:11 EDT by Michal Jaegermann
Modified: 2014-03-16 22:38 EDT (History)
1 user (show)

See Also:
Fixed In Version: FC4
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-09-30 15:57:01 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Michal Jaegermann 2003-09-21 20:11:28 EDT
Description of problem:

There is some strange interaction between /sbin/service and grep.
Look at that:

# service syslog status | grep -q running
/sbin/service: line 65: 18907 Broken pipe             env -i LANG=$LANG
"${SERVICEDIR}/${SERVICE}" ${OPTIONS}

OTOH doing that "directly"

#  /etc/init.d/syslog status | grep -q running && echo ok

prints an expected 'ok'.  Also dropping something else into a pipe, like

# service syslog status | cat | grep -q running && echo ok

is fine.  There are also no troubles if a pattern is not matching
(say 'grep -q xunning') or if instead of '-q' something like that is
used:

# service syslog status | grep running >/dev/null 2>&1 && echo ok

Trying in my /etc/rc.d/init.d/ directory the following script

grep -l 'status)' * | while read s ; do
    echo $s
    service $s status | grep -q running
done

I got that "Broken pipe" error for 'nfs' and 'syslog'.  As far as
I can tell they are the only services I have for which "status" will
produce multiple lines with "running" in them.  The same effects
can be observed on RH9 and RH7.3 installations and also with LANG
set to C or unset so this does not seem to be a problem for
a change.  For example:

sh -x /sbin/service syslog status | grep -q running

will show with LANG unset (for example, but this is not a factor)

....
+ env -i LANG= /etc/init.d/syslog status
/sbin/service: line 65: 19038 Broken pipe             env -i LANG=$LANG
"${SERVICEDIR}/${SERVICE}" ${OPTIONS}

but a direct

env -i LANG= /etc/init.d/syslog status | grep -q running

is not causing any trouble.

Also "folding" an output like that:

(res=$(service syslog status); echo $res) | grep -q running && echo ok

works as expected; this includes services which are not running.

So far I am out of further ideas.
Comment 1 Bill Nottingham 2005-09-30 15:57:01 EDT
Closing bugs on older, no longer supported, releases. Apologies for any lack of
response.

I can't reproduce this in brief testing on FC4. Assuming fixed.

Note You need to log in before you can comment on or make changes to this bug.