Re: [dev] [st][PATCH] Add support for utmp in st

From: <k0ga_AT_shike2.com>
Date: Sat, 11 Oct 2014 10:07:17 +0200

>
> What exactly does "terminal configuration" mean here? TERM, LINES, and
> COLUMNS? Shouldn't st itself be responsible for setting these? They
> certainly don't belong in the profile.

Value of erase key for example, or in general the configuration
of line kernel driver (stty(1)). Backspace key in st generates
BACKSPACE, but almost all terminals generate DELETE instead
(read FAQ for more details). I also have some adittionals
configurations like for example 'tput smkx' (set keypad on),
or `tabs`.About the three variables you tell, TERM is the only
that a terminal must set, LINES and COLUMNS are shell stuff
and are not even standard.

> What is utmp doing, exactly, and why does st want to run the user's
> default shell instead of the SHELL that's passed in to st's environment
> by its parent? Is it appropriate to be setting SHELL to utmp? Why set
> SHELL at all? What program does utmp execute, and is it intentional that
> utmp is not executed if the user specifies a command?

St is creating a new session, in this point is similar to login|(1), and this is
the reason why it initializes the user environment with the data supplied
by /etc/passwd. This code is idential to the code present in login of ubase.
Utmp manages the utmp entry for the session created with st. If you
execute st without utmp support when you execute 'who' then you will
see that the new session is not reported. If you execute utmp then you will
see it.

If true that the solution I propossed is not correct, because SHELL shouldn't
be set to utmp ever. the problem is we are mixing two different things here,
shell of the user and initial program. I suggest something like this:

        sh = (pw->pw_shell[0]) ? pw->pw_shell : shell;
        if (opt_cmd)
                prog = opt_cmd[0];
        else if (utmp)
                prog = utmp;
        else
                prog = sh;
        ...

        setenv("SHELL", sh);
        ...

        execvp(prog, opt_cmd);


That's a pity we have to duplicate very similar code in login, utmp and st.
Maybe we can find a better solution for this topic.


Regards,
Received on Sat Oct 11 2014 - 10:07:17 CEST

This archive was generated by hypermail 2.3.0 : Sat Oct 11 2014 - 10:12:11 CEST