Wrong logging level when signal name (e.g., SIGTERM) is used with normal exit stanza

Bug #1515060 reported by FEI
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
upstart (Ubuntu)
New
Undecided
Unassigned

Bug Description

when using "normal exit 0 SIGTERM" in a job, and if the job is killed with SIGTERM, a warning message will appear in dmesg, like
[330159.038611] init: xxxyyyzzz main process (570) killed by TERM signal

If using "normal exit 0 SIGTERM 15" instead, there won't be such warning message when the job is killed with SIGTERM, 15 is the numerical value for SIGTERM, per "man 7 signal"

After reading the code, it looks to me that the issue is:
1. when parsing "normal exit 0 SIGTERM", the numerical value of SIGTERM is left shifted by 8 and then stored in job->class->normalexit
http://bazaar.launchpad.net/~upstart-devel/upstart/trunk/view/head:/init/parse_job.c#L2433
2. but when determining the appropriate log level, the value in job->class->normalexit is compared directly to numerical value of the signal, (without left shift the signal value)
http://bazaar.launchpad.net/~upstart-devel/upstart/trunk/view/head:/init/job_process.c#L1495

When using "normal exit 0 SIGTERM 15", both "15 << 8" and 15 will be stored in job->class->normalexit, the code to store 15 is at
http://bazaar.launchpad.net/~upstart-devel/upstart/trunk/view/head:/init/parse_job.c#L2428
and thus later on the code to determine log level works.

Note that "normal exit 0 SIGTERM" works well with "respawn", it is just the logging code has the minor bug said above.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.