Re: [hackers] [ubase] Set TERM to linux if needed for su and login || sin

2014-06-03 Thread Roberto E. Vargas Caballero
> > Does it seem reasonable?
> 
> Yup.

Indeed

-- 
Roberto E. Vargas Caballero



Re: [hackers] [ubase] Set TERM to linux if needed for su and login || sin

2014-06-03 Thread Dimitris Papastamos
On Tue, Jun 03, 2014 at 07:44:49PM +0200, Roberto E. Vargas Caballero wrote:
> > but -p is specifically used to tell login whether to preserve or discard
> > the parent environment.  What happens if -p is not set?  I decided to put
> > TERM=linux because ubase is linux specific.
> 
> I think -p is only suitable for values that can be obtained from /etc/passwd,
> for example HOME or SHELL, but in the case of TERM, you only can take the
> correct value from the environment of the parent. I don't know what says
> POSIX about this issue, but maybe should be interesting take a look on it.

>From OpenBSD login manpage:

 -p  By default, login discards any previous environment.  The -p
 option disables this behavior.

I don't think POSIX covers this stuff.

I'll do this:

-p will preserve *all* of the parent's environment and unconditionally set
the values obtained from entries in /etc/passwd (i.e. no fiddling with TERM).

not setting -p will discard *all* of the parent's environment and 
unconditionally
set the values obtained from entries in /etc/passwd. (i.e. no fiddling
with TERM).

Does it seem reasonable?



Re: [hackers] [ubase] Set TERM to linux if needed for su and login || sin

2014-06-03 Thread FRIGN
On Tue, 3 Jun 2014 18:51:19 +0100
Dimitris Papastamos  wrote:

> Does it seem reasonable?

Yup.

-- 
FRIGN 



Re: [hackers] [ubase] Set TERM to linux if needed for su and login || sin

2014-06-03 Thread Roberto E. Vargas Caballero
> but -p is specifically used to tell login whether to preserve or discard
> the parent environment.  What happens if -p is not set?  I decided to put
> TERM=linux because ubase is linux specific.

I think -p is only suitable for values that can be obtained from /etc/passwd,
for example HOME or SHELL, but in the case of TERM, you only can take the
correct value from the environment of the parent. I don't know what says
POSIX about this issue, but maybe should be interesting take a look on it.

-- 
Roberto E. Vargas Caballero



Re: [hackers] [ubase] Set TERM to linux if needed for su and login || sin

2014-06-03 Thread FRIGN
On Tue, 3 Jun 2014 19:35:22 +0200
"Roberto E. Vargas Caballero"  wrote:

> login takes the value of TERM from its parent. If you executed login
> in a telnet session, the telnet daemon will put the value. If you
> have a SystemV inittab, then you configure in it the correct value of
> TERM for every terminal. If you have a BSD /etc/ttys, then you configure
> in it the correct value for every terminal. There is no other usages
> of login, so the only way of getting a null value is a misconfiguration,
> so you should to assume that the terminal only can handle the minimal
> set of features, the features of a dumb terminal.

Agreed. We can't work around any misconfiguration (see Gnome, GNU, ...).

Cheers

FRIGN

-- 
FRIGN 



Re: [hackers] [ubase] Set TERM to linux if needed for su and login || sin

2014-06-03 Thread Dimitris Papastamos
On Tue, Jun 03, 2014 at 07:35:22PM +0200, Roberto E. Vargas Caballero wrote:
> > Would vt100 be more sensible?  Thing is if preserve == 0 we'll end up
> > with TERM unset (for login specifically).
> 
> login takes the value of TERM from its parent. If you executed login
> in a telnet session, the telnet daemon will put the value. If you
> have a SystemV inittab, then you configure in it the correct value of
> TERM for every terminal. If you have a BSD /etc/ttys, then you configure
> in it the correct value for every terminal. There is no other usages
> of login, so the only way of getting a null value is a misconfiguration,
> so you should to assume that the terminal only can handle the minimal
> set of features, the features of a dumb terminal.

but -p is specifically used to tell login whether to preserve or discard
the parent environment.  What happens if -p is not set?  I decided to put
TERM=linux because ubase is linux specific.

I agree with your statement when -p is set, in which case my patch has no
effect (it won't overwrite TERM).



Re: [hackers] [ubase] Set TERM to linux if needed for su and login || sin

2014-06-03 Thread Roberto E. Vargas Caballero
> Would vt100 be more sensible?  Thing is if preserve == 0 we'll end up
> with TERM unset (for login specifically).

login takes the value of TERM from its parent. If you executed login
in a telnet session, the telnet daemon will put the value. If you
have a SystemV inittab, then you configure in it the correct value of
TERM for every terminal. If you have a BSD /etc/ttys, then you configure
in it the correct value for every terminal. There is no other usages
of login, so the only way of getting a null value is a misconfiguration,
so you should to assume that the terminal only can handle the minimal
set of features, the features of a dumb terminal.

Regards,

-- 
Roberto E. Vargas Caballero



Re: [hackers] [ubase] Set TERM to linux if needed for su and login || sin

2014-06-03 Thread Dimitris Papastamos
On Tue, Jun 03, 2014 at 07:25:39PM +0200, Roberto E. Vargas Caballero wrote:
> > Set TERM to linux if needed for su and login
> 
> I think this is incorrect. If you don't have a value of TERM, then
> you should don't put anything, or put dumb, but why linux?, you
> expect login will be executed only in virtual terminals?.

Would vt100 be more sensible?  Thing is if preserve == 0 we'll end up
with TERM unset (for login specifically).



Re: [hackers] [ubase] Set TERM to linux if needed for su and login || sin

2014-06-03 Thread Roberto E. Vargas Caballero
> Set TERM to linux if needed for su and login

I think this is incorrect. If you don't have a value of TERM, then
you should don't put anything, or put dumb, but why linux?, you
expect login will be executed only in virtual terminals?.

Regards,

-- 
Roberto E. Vargas Caballero