Bug 50680 - anti-social to run tty-less scripts with "exec -l"
Summary: anti-social to run tty-less scripts with "exec -l"
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Raw Hide
Classification: Retired
Component: xinitrc
Version: 1.0
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Mike A. Harris
QA Contact: Aaron Brown
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-08-02 00:54 UTC by Jonathan Kamens
Modified: 2007-04-18 16:35 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2001-08-02 01:48:39 UTC
Embargoed:


Attachments (Terms of Use)

Description Jonathan Kamens 2001-08-02 00:54:48 UTC
The recent changes to xinitrc to use "exec -l" instead of "exec" to start
the user's session are problematic.

In particular, it is reasonable for a user to assume, when writing his
.login or .profile file, that it will be executed in a terminal, since how
can you log in without a terminal?  But the commands run in
/etc/X11/xdm/Xsession are not, in fact, run in a terminal.  This causes all
kinds of grief from my .login file.  Here's my ~/.xsession-errors file from
just logging in:

Enter SSH passphrase: 
Entering port-forwarding mode: P4PORT=1666, PID=21293
jik:~!1> cat ~/.xsession-errors 
Enter SSH passphrase: stty: impossible in this context
are you disconnected or in a batch, at, or cron script?stty: ioctl(user):
bad file number

    while executing
"stty -echo"
    ("while" body line 4)
    invoked from within
"while {1} {
    send_user "Enter SSH passphrase: "

    stty -echo

    set old_timeout $timeout
    set timeout -1
    expect_user {
        -re "(.+..."
    (file "/home/jik/scripts/ssh-add-both" line 8)
Could not open a connection to your authentication agent.
Agent pid 21177
stderr is not a tty - where are you?
stderr is not a tty - where are you?

It's prompting me for my passphrase because my .login does that, which is
quite reasonable because it's supposed to be running inside a tty.  All of
the stty you see are from an expect script which has the same problem.

Basically, I'm not at all convinced this change is appropriate.

Comment 1 Havoc Pennington 2001-08-02 02:16:25 UTC
> how can you log in without a terminal? 

Well, the answer is "using xdm/gdm/kdm", basically ;-)

An X session is a login session. Read the "INVOCATION" section in the bash man
page - there are interactive shells and login shells. Login shells may or may
not be interactive shells.

So in your .profile you would do something like: 

if test -n "$PS1"; then 
  echo "This is an interactive shell"
  ssh-add
  ## etc.
fi

But X session login shells could also be interactive I suppose, e.g. if you use
startx instead of *dm.

Actually my bash help probably isn't so useful - since you are using .login I
assume you're using tcsh. Xsession has always run a bash as a login shell; we
changed it to make tcsh, etc. consistent. So bash users will already be seeing
the no-tty-login-shell behavior and have dealt with this... but tcsh users were
not getting their session set up properly (/etc/csh.login did not affect the
entire X session).

Quickly scanning the tcsh man page I don't see how to check whether you have an
interactive shell, but there must be a way to do that in tcsh.

We definitely need a mention of this change in the release notes...



Note You need to log in before you can comment on or make changes to this bug.