* GNU screen not seeing $SHELL env var?
@ 2012-06-20 13:20 Tom Rodman
2012-06-20 14:08 ` Eric Blake
0 siblings, 1 reply; 5+ messages in thread
From: Tom Rodman @ 2012-06-20 13:20 UTC (permalink / raw)
To: cygwin
Not sure when this problem started. The issue:
GNU screen is starting w/an empty or undefined value for $SHELL, so
the login shell for all screen windows is incorrect:
$ uname -a; cygcheck -c cygwin
CYGWIN_NT-5.1 aqua 1.7.16s(0.261/5/3) 20120604 01:26:35 i686 Cygwin
Cygwin Package Information
Package Version Status
cygwin 1.7.15-1 OK
$ cygcheck -f /bin/screen
screen-4.0.3-7
$ grep SHELL ~/.screenrc
shell -$SHELL
$ echo $SHELL
/bin/bash
$ bash -c 'echo SHELL: $SHELL' # does this prove SHELL is exported?
SHELL: /bin/bash
$ screen
--snip/switch to a separate shell to run [procps -wwH -o pid,ppid,user,tty,args -e]:
5988 2200 adm_tsr pty3 /bin/bash --login
1492 5988 adm_tsr pty3 screen
4476 1492 adm_tsr ? SCREEN
5420 4476 adm_tsr pty4 -
--snip/now to shell w/pid 5420 inside screen:
$ echo SHELL: \[$SHELL]
SHELL: []
$
Notice above that pid 5420 is named '-', which corresponds
to /bin/sh, instead of /bin/bash.
$ command ps -elW |grep 5420
I 5420 4476 5420 2476 pty4 1008 07:54:08 /usr/bin/sh
The workaround is to export SHELL prior to starting screen.
I do not understand why that works, it seems that SHELL was already
exported, since (in a non screen login shell):
sh -c 'echo SHELL: $SHELL'
echos /bin/bash
Is anyone else seeing this issue?
--
thanks,
Tom
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: GNU screen not seeing $SHELL env var?
2012-06-20 13:20 GNU screen not seeing $SHELL env var? Tom Rodman
@ 2012-06-20 14:08 ` Eric Blake
2012-06-20 14:54 ` Tom Rodman
0 siblings, 1 reply; 5+ messages in thread
From: Eric Blake @ 2012-06-20 14:08 UTC (permalink / raw)
To: cygwin
[-- Attachment #1: Type: text/plain, Size: 663 bytes --]
On 06/20/2012 07:20 AM, Tom Rodman wrote:
> $ echo $SHELL
> /bin/bash
> $ bash -c 'echo SHELL: $SHELL' # does this prove SHELL is exported?
> SHELL: /bin/bash
No. And in fact, bash does not export SHELL by default, but defaults to
defining SHELL as a shell-local variable. You have to explicitly export
it yourself if you want child processes to see it.
$ env -u SHELL bash -c 'echo $SHELL'
/bin/bash
$ env -u SHELL bash -c 'env | grep SHELL'
$ env -u SHELL bash -c 'export SHELL; env | grep SHELL'
SHELL=/bin/bash
$
--
Eric Blake eblake@redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 620 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: GNU screen not seeing $SHELL env var?
2012-06-20 14:08 ` Eric Blake
@ 2012-06-20 14:54 ` Tom Rodman
2012-06-20 15:25 ` Corinna Vinschen
0 siblings, 1 reply; 5+ messages in thread
From: Tom Rodman @ 2012-06-20 14:54 UTC (permalink / raw)
To: cygwin
On Wed 6/20/12 8:07 MDT Eric Blake wrote:
> On 06/20/2012 07:20 AM, Tom Rodman wrote:
>
> > $ echo $SHELL
> > /bin/bash
> > $ bash -c 'echo SHELL: $SHELL' # does this prove SHELL is exported?
> > SHELL: /bin/bash
>
> No. And in fact, bash does not export SHELL by default, but defaults to
> defining SHELL as a shell-local variable. You have to explicitly export
> it yourself if you want child processes to see it.
OK. Thanks, good to know that.
--
Still, not sure why I have to export the SHELL var to GNU screen
now since in the past several years I have not done this.
Recently I stopped using 'putty -ssh localhost' for my terminal,
and I'm using 'rxvt' instead, but I can not see why that would
matter. In Linux, 'screen' sets up login shells correctly, I
use the same ~/.screenrc for both cygwin and linux, and I'm not
exporting SHELL to screen in linux.
Non cygwin question: what is the best way to tell GNU screen to
read /etc/passwd to get SHELL, and start all new screen windows
with login shells?
--
thanks,
Tom
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: GNU screen not seeing $SHELL env var?
2012-06-20 14:54 ` Tom Rodman
@ 2012-06-20 15:25 ` Corinna Vinschen
2012-06-20 16:27 ` Tom Rodman
0 siblings, 1 reply; 5+ messages in thread
From: Corinna Vinschen @ 2012-06-20 15:25 UTC (permalink / raw)
To: cygwin
On Jun 20 09:53, Tom Rodman wrote:
> On Wed 6/20/12 8:07 MDT Eric Blake wrote:
> > On 06/20/2012 07:20 AM, Tom Rodman wrote:
> >
> > > $ echo $SHELL
> > > /bin/bash
> > > $ bash -c 'echo SHELL: $SHELL' # does this prove SHELL is exported?
> > > SHELL: /bin/bash
> >
> > No. And in fact, bash does not export SHELL by default, but defaults to
> > defining SHELL as a shell-local variable. You have to explicitly export
> > it yourself if you want child processes to see it.
>
> OK. Thanks, good to know that.
>
> --
> Still, not sure why I have to export the SHELL var to GNU screen
> now since in the past several years I have not done this.
> Recently I stopped using 'putty -ssh localhost' for my terminal,
> and I'm using 'rxvt' instead, ...
Brr. Why don't you use mintty instead? rxvt is old, unmaintained,
and it doesn't support UTF-8.
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
Red Hat
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: GNU screen not seeing $SHELL env var?
2012-06-20 15:25 ` Corinna Vinschen
@ 2012-06-20 16:27 ` Tom Rodman
0 siblings, 0 replies; 5+ messages in thread
From: Tom Rodman @ 2012-06-20 16:27 UTC (permalink / raw)
To: cygwin
On Wed 6/20/12 17:24 +0200 Corinna wrote:
> On Jun 20 09:53, Tom Rodman wrote:
> > On Wed 6/20/12 8:07 MDT Eric Blake wrote:
> > > On 06/20/2012 07:20 AM, Tom Rodman wrote:
> > >
> > > > $ echo $SHELL
> > > > /bin/bash
> > > > $ bash -c 'echo SHELL: $SHELL' # does this prove SHELL is exported?
> > > > SHELL: /bin/bash
> > >
> > > No. And in fact, bash does not export SHELL by default, but defaults to
> > > defining SHELL as a shell-local variable. You have to explicitly export
> > > it yourself if you want child processes to see it.
> >
> > OK. Thanks, good to know that.
> >
> > --
> > Still, not sure why I have to export the SHELL var to GNU screen
> > now since in the past several years I have not done this.
> > Recently I stopped using 'putty -ssh localhost' for my terminal,
> > and I'm using 'rxvt' instead, ...
>
> Brr. Why don't you use mintty instead? rxvt is old, unmaintained,
> and it doesn't support UTF-8.
Oh, I was afraid it might be deprecated, I had tried mintty in the
last few weeks, but was unable to get 'WordChars' setting to work
as well as rxvt's cutchars.
I launch rxvt with a shell script using:
font_sz=${1:-17}
cutchars=$'\140'$'\042'$'\047''+-&()*,;<=>?@[]{|}/.:'
# \140 == `
# \042 == "
# \047 == '
# "Rxvt*cutchars" in ~/.Xdefaults ( usually a link to /etc/skel/.Xdefaults )
# but stopped working for me, 1st noticed not working in 2012 or 2011
exec rxvt \
-cutchars $cutchars \
-backspacekey $'\010' -geometry 100x33 \
+rv \
-bg black \
-fg white \
-fn "Lucida Console-$font_sz" \
-sr -sl 5000 \
-e /bin/bash --login
I've been unable to get the equivalent of cutchars to work in mintty.
Putty was good at that, but I stopped using putty because of the 'procps' hangs.
--
Tom
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-06-20 16:27 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-20 13:20 GNU screen not seeing $SHELL env var? Tom Rodman
2012-06-20 14:08 ` Eric Blake
2012-06-20 14:54 ` Tom Rodman
2012-06-20 15:25 ` Corinna Vinschen
2012-06-20 16:27 ` Tom Rodman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).