Bug 55954

Summary: pidof -o option broken
Product: [Retired] Red Hat Raw Hide Reporter: Bernhard Rosenkraenzer <bero>
Component: SysVinitAssignee: Bill Nottingham <notting>
Status: CLOSED RAWHIDE QA Contact: David Lawrence <dkl>
Severity: high Docs Contact:
Priority: high    
Version: 1.0CC: rvokal
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-11-09 12:57:58 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Bernhard Rosenkraenzer 2001-11-09 12:47:18 UTC
Description of Problem:
The -o option of pidof is broken in 2.79-1.
This breaks the "status" function in /etc/init.d/functions, in effect 
breaking /sbin/service anything status.

Version-Release number of selected component (if applicable):
2.79-1

How Reproducible:
100%

Steps to Reproduce:
[root@spock sysconfig]# ps ax |grep bash
  945 tty1     S      0:00 -bash
 1225 tty2     S      0:00 -bash
27296 pts/5    S      0:00 -bash
14569 tty3     S      0:00 -bash
14658 tty3     S      0:00 /bin/bash /usr/bin/startkde
17586 tty4     S      0:00 -bash
20022 pts/1    S      0:00 /bin/bash
25052 pts/2    S      0:00 /bin/bash
27590 pts/3    S      0:00 /bin/bash
31359 pts/4    S      0:00 /bin/bash
32431 pts/1    S      0:00 grep --color=tty bash
[root@spock sysconfig]# pidof -o 20022 -o 25052 bash
31359 27590 25052 20022 14658


Actual Results:
31359 27590 25052 20022 14658

Expected Results:
31359 27590 14658


Additional Information:

Comment 1 Bernhard Rosenkraenzer 2001-11-09 12:54:17 UTC
This is on a full dist-8.0 system; might also be caused by a breakage in glibc 
2.2.4-20.2's getopt or the likes.


Comment 2 Bernhard Rosenkraenzer 2001-11-09 12:57:52 UTC
It's a bug in sysvinit itself.

 while ((p = get_next_from_pid_q(q))) {
       if (flags & PIDOF_OMIT) {
              for (i = 0; i < oind; i++)
                     if (opid[i] == p->pid)
                             continue;
	[...]
       }
       [print pid]
 }

Looks like someone forgot that continue; affects for() as well as while(). ;)
Fixing.


Comment 3 Bernhard Rosenkraenzer 2001-11-09 13:12:29 UTC
Fixed in 2.79-2