Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 62318 - su+bash causes execution of cmdline buffer when killed with SIGKILL
Summary: su+bash causes execution of cmdline buffer when killed with SIGKILL
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo's Team for Core System packages
URL: http://lists.gnu.org/archive/html/bug...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-30 17:34 UTC by Stefan de Konink
Modified: 2007-03-26 00:32 UTC (History)
3 users (show)

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 Stefan de Konink 2004-08-30 17:34:58 UTC
If you type in a xterm, su <enter>, your pass, program <close the window> the program gets executed. This behavior doesn't work when you actually kill the xterm itself.

Reproducible: Always
Steps to Reproduce:
1. start xterm
2. su
3. programname <no enter>
4. close the window

Actual Results:  
program gets executed

Expected Results:  
a killed xterm
Comment 1 Thomas Dickey 2004-09-11 15:32:32 UTC
I don't see this in a quick check.  Perhaps it depends on your
shell (which may be supplying a newline, to be helpful).
Comment 2 Stefan de Konink 2004-09-11 16:20:15 UTC
I'm using Bash as shell. The best thing to show is probably:

1. start xterm
2. su
3. xterm
4. close the window

Actual Results:
1. Clean root xterm

Expected Results:
1. A closed window
Comment 3 Thomas Dickey 2004-09-11 16:30:08 UTC
I still don't see this (on Debian/testing).  But it seems
that the shell would be the first place to look (if one
were to trace things to isolate this).
Comment 4 Seemant Kulleen (RETIRED) gentoo-dev 2005-04-14 11:51:34 UTC
I'm not seeing this behaviour.  Closing bug for lack of response from original reporter.  Please reopen if this persists.
Comment 5 Stefan de Konink 2005-04-14 13:10:59 UTC
It is still there, same sequence.

open a xterm
su [passphrase] [enter]
xterm [NOENTER]
close the window, you now get an xterm started as root
Comment 6 Seemant Kulleen (RETIRED) gentoo-dev 2005-04-15 07:38:16 UTC
ick! I _do_ see this
Comment 7 Thomas Dickey 2005-04-15 07:43:43 UTC
Since you see it and I don't, it's either that I'm misreading
the description, or there's some difference in environment.
My login shell is /bin/tcsh (perhaps changing that to bash
would expose a bug).
Comment 8 Seemant Kulleen (RETIRED) gentoo-dev 2005-04-15 07:59:45 UTC
this is, a bug in su, not xterm or shell, apparently, because it happens in screen (with any term) as well.
Comment 9 Diego Elio Pettenò (RETIRED) gentoo-dev 2005-04-15 08:05:46 UTC
The bug is not on xterm, it does the same with konsole and screen (^A K to kill a session with a su shell).

It's probably su-related (as it does nothing on a simple non-su shell). Seems like the problem is on handling of SIGTERM by su.

[seems like bgo is slow as hell for me, this is going to be added two comments later than i have submitted it.]
Comment 10 Diego Elio Pettenò (RETIRED) gentoo-dev 2005-04-15 08:28:15 UTC
I'm sorry, it's not SIGTERM which is thrown in that case, but SIGHUP..
I'm still trying to figure out where does it's handled.
Comment 11 Martin Schlemmer (RETIRED) gentoo-dev 2005-07-04 08:07:46 UTC
Does not happen with gnome-terminal btw.
Comment 12 Martin Schlemmer (RETIRED) gentoo-dev 2005-07-04 08:38:21 UTC
Ok, I researched it just a bit .. seems that if su gets a SIGTERM, it handles it
just fine, kills bash/whatever, and this issue does not happen (so I assume
without looking at the code, that gnome-terminal sends a SIGTERM).

If you however send it a SIGKILL, it does not handle it, and for some reason
bash executes the last command on its commandline.

I have tried to add the signal handler for SIGTERM to SIGKILL as well in su.c,
but it really does not like that, and I have not checked why the sigaction()
call fails just yet ...  I will have another peak later on if somebody else do
not get to it before me.