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: 1286209179-0de81ffb0001-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: <4CA9FE9B.7020004@fgm.com> Date: Mon, 4 Oct 2010 12:19:39 -0400 From: Daniel Barclay 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: 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> X-ASG-Orig-Subj: Re: bash bug?: nested "bash --login -i" doesn't run /etc/profile (still runs ~/.bash_profile) In-Reply-To: <4CA4CFE3.1090300@fgm.com> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit X-Barracuda-Connect: UNKNOWN[216.2.55.102] X-Barracuda-Start-Time: 1286209179 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 Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com I wrote: > The behavior of "bash --login -i" seems to vary depending on whether > it is a "root" invocation or a nested invocation of bash. This is > inconsistent with the description man bash, and seems to be a bug. Can anyone confirm (or "anti-confirm") this behavior?: > Details: > > > 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. > > Interestingly, that nested bash shell _does_ still read > ~/.bash_profile. > > According to the bash manual page, "bash --login -i" should read > /etc/profile in either case. (There is no mention of anything, e.g., > an environment variable from the context of the invocation, that > changes the behavior of that command.) > > > An additional symptom is that the nested bash does not listen to > SHELLOPTS as expected: > > 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". > > It seems that something is going wrong between the points at which bash > reads SHELLOPTS and runs /etc/profile and the point at which bash runs > ~/.bash_profile. 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