Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 282094 - sys-apps/shadow-4.1.2.2. Please, add to "su.1" that su after receiving SIGTERM unconditionally shoots (w/ SIGKILL) child after 2 second and return -1 (255).
Summary: sys-apps/shadow-4.1.2.2. Please, add to "su.1" that su after receiving SIGTER...
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High trivial (vote)
Assignee: Gentoo's Team for Core System packages
URL: http://lists.alioth.debian.org/piperm...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-20 11:57 UTC by vyp08
Modified: 2009-09-08 21:15 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description vyp08 2009-08-20 11:57:51 UTC
Good day!

  I have a program that starts from other program (supervisor runit) through su: 'su -c "program --bla --bla --bla" $username'.
  When the supervisor is trying to close the program by sending a signal 15 to su, it get a return code of 255, while the program tells the return code 0. 
  After reading the su's source code, I found that when signal SIGTERM, su sends the signal SIGTERM to child, and after 2 seconds sends a SIGKILL and ends with code -1 (255).
  In doing so, such conduct su nowhere specified. 
  Logs from my program:

[..]
 1. 2009-08-20_06:30:58.80296 10:30:58.802852 4497/4514 556192/58208 archiver.cpp[492] evt_thread() info: pthread_mutex_unlock( &g_mutex_evt )
 2. 2009-08-20_06:30:58.80312 10:30:58.803030 4497/4514 556192/58208 archiver.cpp[460] evt_thread() info: pthread_mutex_lock( &g_mutex_evt_thread )
 3. !!! 2009-08-20_06:30:59.35957 Session terminated, killing shell...10:30:59.357145 4497/4497 556192/58208 archiver.cpp[94] sig_handler() enex: enter
 4. 2009-08-20_06:30:59.35967 10:30:59.357278 4497/4497 556192/58208 archiver.cpp[98] sig_handler() info: Signal 15 - "Terminated" handled
[..]
 5. 2009-08-20_06:30:59.42866 10:30:59.428504 4497/4497 218424/395976 archiver.cpp[787] quit() info: free(): t->name == 0x9d116c0
 6. 2009-08-20_06:30:59.42880 10:30:59.428588 4497/4497 218400/396000 archiver.cpp[788] quit() info: free(): t == 0x9d2e700
 7. 2009-08-20_06:30:59.42884 10:30:59.428694 4497/4497 218104/396296 archiver.cpp[794] quit() info: QCoreApplication::exit( g_rc == 0 )
 8. !!! 2009-08-20_06:31:01.35691  ...killed.
 9. 2009-08-20_06:31:01.37258 ./finish: stop "er21-archiver, $@ == 255 0, rc1 == 255, rc2 == 0"
10. 2009-08-20_06:31:01.37378 ./finish(er21-archiver): return code is not 0 (255), service "er21-archiver" down.
[..]

  As can be seen from line 7, the child has long exited with the code 0, but after 2 seconds su wake up, send signal SIGKILL (where to?! if someone will get child's pid?!) and return -1 (255). This is not good :((

  Please add explanations to the "su.1".


Best regards.

P.S. su from coreutils work fine, since do execv child instead fork.


Reproducible: Always

Steps to Reproduce: