delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/06/20/09:21:14

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-0.7 required=5.0 tests=AWL,BAYES_00,SPF_HELO_NEUTRAL,TW_YG
X-Spam-Check-By: sourceware.org
Message-Id: <201206201320.q5KDKWp4005645@localhost.localdomain>
To: cygwin AT cygwin DOT com
From: Tom Rodman <cygzr AT trodman DOT com>
Reply-to: cygwin AT cygwin DOT com
Subject: GNU screen not seeing $SHELL env var?
Date: Wed, 20 Jun 2012 08:20:32 -0500
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019