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.
-- Bruce
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).
SIGHUP 1 Term Hangup detected on controlling terminal
or death of controlling process
SIGINT 2 Term Interrupt from keyboard
SIGQUIT 3 Core Quit from keyboard
SIGILL 4 Core Illegal Instruction
SIGABRT 6 Core Abort signal from abort(3)
SIGFPE 8 Core Floating-point exception
SIGKILL 9 Term Kill signal
SIGSEGV 11 Core Invalid memory reference
SIGPIPE 13 Term Broken pipe: write to pipe with no
readers; see pipe(7)
SIGALRM 14 Term Timer signal from alarm(2)
SIGTERM 15 Term Termination signal
SIGUSR1 30,10,16 Term User-defined signal 1
SIGUSR2 31,12,17 Term User-defined signal 2
SIGCHLD 20,17,18 Ign Child stopped or terminated
SIGCONT 19,18,25 Cont Continue if stopped
SIGSTOP 17,19,23 Stop Stop process
SIGTSTP 18,20,24 Stop Stop typed at terminal
SIGTTIN 21,21,26 Stop Terminal input for background process
SIGTTOU 22,22,27 Stop Terminal output for background process
--
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