On 3/30/21 7:51 AM, Scott Andrews wrote:

On 3/30/21 12:34 AM, Bruce Dubbs wrote:
On 3/29/21 7:30 PM, Scott Andrews wrote:

The existing function does not return a correct result for all signal types.


# check_sig_type() #

Original less empty lines

check_sig_type()

{
     local valsig
     # The list of termination signals (limited to generally used items)
     valsig="-ALRM -INT -KILL -TERM -PWR -STOP -ABRT -QUIT -2 -3 -6 -9 -14 -15"
     echo "${valsig}" | grep -- " ${1} " > /dev/null
     if [ "${?}" -eq "0" ]; then
         return 0
     else
         return 1
     fi
}

You are right, there is an error.  The grep is for " ${1} " and there is no leading space for -ALRM and no trailing space for -15.  A simple fix.

That said, I checked the usage.  The function is only used by killproc in init-functions.  Checking further, the scripts that call killproc only refer to -HUP, -QUIT, -USR1, and -USR2.

That said, it should be fixed, but is low priority and should be deferred until the next change is necessary.

It also fails if the signal does not have a - before it.  Notice the function should take -ALRM and ALRM, according to the notes before the function.  Also man 7 signal gives the signal as SIGALRM, most are prefixed by SIG, also notice that they don't have - in front of them (standard signals).

Yes, the comments are wrong. The signal is used by killproc which uses the kill command without -s. That makes the leading dash required for this implementation.

  -- Bruce

--
http://lists.linuxfromscratch.org/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Do not top post on this list.

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

http://en.wikipedia.org/wiki/Posting_style

Reply via email to