Bug 186879

Summary: su -c "command" has no controlling terminal anymore
Product: [Fedora] Fedora Reporter: Karel van Houten <karel>
Component: coreutilsAssignee: Tim Waugh <twaugh>
Status: CLOSED NOTABUG QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 5CC: karel, lav, meyering
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-03-27 03:40:22 EST Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Karel van Houten 2006-03-27 03:32:12 EST
Description of problem:

When using su -c "bash" (for example), the resulting bash shell has no access to
its controlling terminal (/dev/tty), so there is no job-control possible, and
tools like 'resize' fail.

Version-Release number of selected component (if applicable):
coreutils 5.93 (bug was not present in the FC4 version 5.2.1)

How reproducible: allways.

Steps to Reproduce:
1. su root -c "bash" (enter password)
2. cat
3. type ^C to interrupt.
Actual results:
[karel@fc5 karel]$ /bin/su root -c "bash"
[root@fc5 karel]# cat
(type ^C)
Session terminated, killing shell... ...killed.
(session hangs, with 2 processes reading from terminal)

Expected results:
[karel@fc5 karel]$ /tmp/su4 root -c "bash"
[root@fc5 karel]# cat
(type ^C)
[root@fc5 karel]# exit

Additional info:
Comment 1 Tim Waugh 2006-03-27 03:40:22 EST
Use '-s' to run a particular shell.  -c is not for interactive commands.
Comment 2 Karel van Houten 2006-03-28 00:37:20 EST
I've made a workaround based on the -s option. But I disagree that this is not a
bug. I have scripts, that start an interactive command, using su -c, where the
command has to accept arguments. This is not possible with the -s option.  These
scripts have worked on all unix versions (hpux, solaris), up to Fedora 4, and
now starting with Fedora 5, I have to code these scripts different for linux and
other unices. I don't think that is the way to go for unix.