This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: bash bug?: nested "bash --login -i" doesn't run /etc/profile (still runs ~/.bash_profile)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]