NetBSD-Bugs archive

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

misc/53145: Improved POSIX and X/OPEN conformance (/etc/rc.subr)



>Number:         53145
>Category:       misc
>Synopsis:       Improved POSIX and X/OPEN conformance (/etc/rc.subr)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    misc-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun Apr 01 04:40:00 +0000 2018
>Originator:     Bruce Lilly
>Release:        6.1.5-7.1.2
>Organization:
none
>Environment:
N/A
>Description:
/etc/rc.subr uses non-standard (vs. POSIX, X/OPEN) arguments to ps.

>How-To-Repeat:
Install heirloom-ps e.g. using pkgin.
su to root
Put one of the binary subdirectories (e.g. /usr/pkg/heirloom/bin/posix)
early in PATH
Run an rc command, e.g. '/etc/rc.d/cron status'
>Fix:
Patch /etc/rc.subr:
############# cut here #######################
*** etc/rc.subr Sat Nov  7 19:45:22 2015
--- /etc/rc.subr        Sat Mar 31 23:35:34 2018
***************
*** 213,215 ****
        fi
!       _find_processes $_procname ${_interpreter:-.} '-ax'
  }
--- 213,215 ----
        fi
!       _find_processes $_procname ${_interpreter:-.} '-A'
  }
***************
*** 272,274 ****
        _proccheck='
!               ps -o "pid,command" '"$_psargs"' |
                while read _npid '"$_fp_args"'; do
--- 272,274 ----
        _proccheck='
!               ps -o "pid,comm" '"$_psargs"' |
                while read _npid '"$_fp_args"'; do
############# cut here #######################

Tested on NetBSD 6.1.5, 7.0, 7.0.2, 7.1, 7.1.2 with NetBSD /bin/ps and with all variants (posix/,posix2001/,s42/, and plain) of heirloom-ps.

Change of '-ax' to '-A' is reported on the NetBSD /bin/ps man page as equivalent and conforms to POSIX and X/OPEN standards.  Change of '-o pid,command' to '-o pid,comm' is supported by NetBSD /bin/ps (although it is undocumented) and conforms to POSIX and X/OPEN standards.

Bonus: /etc/rc.subr file size is reduced by 4 bytes.



Home | Main Index | Thread Index | Old Index