| www.delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| X-SWARE-Spam-Status: | No, hits=-1.6 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,T_RP_MATCHES_RCVD |
| X-Spam-Check-By: | sourceware.org |
| X-ASG-Debug-ID: | 1286374254-0de83c6a0001-w5GHUG |
| X-Barracuda-Envelope-From: | daniel AT fgm DOT com |
| X-Barracuda-Apparent-Source-IP: | 216.2.55.102 |
| X-ASG-Whitelist: | Client |
| Message-ID: | <4CAC836D.80108@fgm.com> |
| Date: | Wed, 6 Oct 2010 10:10:53 -0400 |
| From: | Daniel Barclay <daniel AT fgm DOT com> |
| User-Agent: | Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.13) Gecko/20100914 SeaMonkey/2.0.8 |
| MIME-Version: | 1.0 |
| To: | <cygwin AT cygwin DOT com> |
| Subject: | Re: bash bug?: nested "bash --login -i" doesn't run /etc/profile (still runs ~/.bash_profile) |
| References: | <4CA4CFE3 DOT 1090300 AT fgm DOT com> <4CA9FE9B DOT 7020004 AT fgm DOT com> <4CAA4056 DOT 2070207 AT cygwin DOT com> <4CAB323A DOT 6060802 AT fgm DOT com> <4CABA847 DOT 9050608 AT cygwin DOT com> |
| X-ASG-Orig-Subj: | Re: bash bug?: nested "bash --login -i" doesn't run /etc/profile (still runs ~/.bash_profile) |
| In-Reply-To: | <4CABA847.9050608@cygwin.com> |
| X-Barracuda-Connect: | UNKNOWN[216.2.55.102] |
| X-Barracuda-Start-Time: | 1286374254 |
| X-Barracuda-Encrypted: | AES128-SHA |
| X-Barracuda-URL: | http://spam.fgm.com:8000/cgi-mod/mark.cgi |
| X-IsSubscribed: | yes |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Unsubscribe: | <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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 |
Larry Hall (Cygwin) wrote:
> On 10/5/2010 10:12 AM, Daniel Barclay wrote:
>> Larry Hall (Cygwin) wrote:
>>> On 10/4/2010 12:19 PM, Daniel Barclay wrote:
...
>>>> Can anyone confirm (or "anti-confirm") this behavior?:
...
>>>>> When bash is started using the Cygwin shortcut (which runs cygwin.bat,
>>>>> which executes "bash --login -i"), bash reads files /etc/profile and
>>>>> ~/.bash_profile. (Running "bash --login -i" from an interactive
>>>>> "cmd" shell does the same.)
>>>>>
>>>>> However, when in that first bash process, another bash is started with
>>>>> that same "bash --login -i" command, bash does _not_ read
>>>>> /etc/profile.
>>>
>>> Works for me.
>>
>> How did you detect that that second bash runs /etc/profile?
>
> I added "set -x" to the file so it would show me when it was running.
Thanks. Hey, did you do that in addition to all my "steps to reproduce"
(re-quoted below) or instead of some of them (in particular, setting
SHELLOPTS)?
I ask because I wonder if the problem is somewhere in or nears bash's
startup code that reads SHELLOPTS, because we both turned on the
"set -x"/"xtrace" tracing, but got different results--and there might
be a difference in how we turned on that tracing.
(I'll also check with just "set -x" and without setting SHELLOPTS.
For your convenience, here's a "requote" of the SHELLOPTS behavior I
saw and my "Steps to reproduce" paragraph:
---------------------------------------------
A root invocation notices "igncr", "verbose", and "xtrace" in the
SHELLOPTS value from its invocation environment (the Windows/cmd
environment variable) as specified--it ends up setting SHELLOPTS in
itself to a value that includes those options.
On the other hand, a nested invocation seems to ignore the SHELLOPTS
from its invocation environment (the environment variable from the
first bash shell/process)--it sets its SHELLOPTS to a value that does
_not_ include those options.)
Steps to reproduce (and easily see difference):
1. Set Windows environment variable SHELLOPTS to
"igncr:verbose:xtrace".
2. Start bash using the installer-created Cygwin shortcut.
3. Notice (from the output from the "verbose" and "xtrace" options)
that bash runs /etc/profile and then ~/.bash_profile.
4. Notice (from "set") that SHELLOPTS in bash includes "igncr",
"verbose" and "xtrace" (among other options).
5. Execute "bash --login -i".
6. Notice (again, from the verbose/xtrace output) that bash does
_not_ run /etc/profile, but still runs ~/.bash_profile.
7. Notice that SHELLOPTS in that invocation of bash does not include
"igncr", "verbose" or "xtrace". ---
---------------------------------------------
Thanks.
Daniel
--
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
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |