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
Re: bash bug?: nested bash --login -i doesn't run /etc/profile (still runs ~/.bash_profile)
Larry Hall (Cygwin) wrote: On 10/4/2010 12:19 PM, Daniel Barclay wrote: 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. Works for me. How did you detect that that second bash runs /etc/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
Re: bash bug?: nested bash --login -i doesn't run /etc/profile (still runs ~/.bash_profile)
On 10/5/2010 10:12 AM, Daniel Barclay wrote: Larry Hall (Cygwin) wrote: On 10/4/2010 12:19 PM, Daniel Barclay wrote: 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. 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. -- Larry Hall http://www.rfk.com RFK Partners, Inc. (508) 893-9779 - RFK Office 216 Dalton Rd. (508) 893-9889 - FAX Holliston, MA 01746 _ A: Yes. Q: Are you sure? A: Because it reverses the logical flow of conversation. Q: Why is top posting annoying in email? -- 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
Re: bash bug?: nested bash --login -i doesn't run /etc/profile (still runs ~/.bash_profile)
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
Re: bash bug?: nested bash --login -i doesn't run /etc/profile (still runs ~/.bash_profile)
On 10/4/2010 12:19 PM, Daniel Barclay wrote: 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. Works for me. -- Larry Hall http://www.rfk.com RFK Partners, Inc. (508) 893-9779 - RFK Office 216 Dalton Rd. (508) 893-9889 - FAX Holliston, MA 01746 _ A: Yes. Q: Are you sure? A: Because it reverses the logical flow of conversation. Q: Why is top posting annoying in email? -- 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
bash bug?: nested bash --login -i doesn't run /etc/profile (still runs ~/.bash_profile)
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. 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. Daniel (user name - username) (Windows/DNS domain name - somedomain) Cygwin Configuration Diagnostics Current System Time: Thu Sep 30 13:21:26 2010 Windows XP Professional Ver 5.1 Build 2600 Service Pack 3 Path: C:\tools\cygwin\usr\local\bin C:\tools\cygwin\bin C:\tools\cygwin\bin C:\Username\bin C:\tools\jdk1.6.0_21\bin C:\tools\apache-ant-1.7.1\bin C:\tools\emacs-23.2\bin C:\WINDOWS\system32 C:\WINDOWS C:\WINDOWS\System32\Wbem C:\WINDOWS\system32\WindowsPowerShell\v1.0 C:\Program Files\Microsoft SQL Server\80\Tools\Binn\ C:\tools\cygwin\bin Output from C:\tools\cygwin\bin\id.exe UID: 12734(username) GID: 10513(Domain Users) 10513(Domain Users) 0(root) 544(Administrators) 545(Users) SysDir: C:\WINDOWS\system32 WinDir: C:\WINDOWS USER = 'username' PWD = '/c/Username' HOME = '/c/Username' HOMEPATH = '\Documents and Settings\username' MANPATH = '/usr/local/man:/usr/share/man:/usr/man:' APPDATA = 'C:\Documents and Settings\username\Application Data' HOSTNAME = 'november' TERM = 'cygwin' PROCESSOR_IDENTIFIER = 'x86 Family 15 Model 4 Stepping 1, GenuineIntel' HISTSIZE = '5000' WINDIR = 'C:\WINDOWS' IGNOREEOF = '10' OLDPWD = '/usr/bin' USERDOMAIN = 'SOMEDOMAIN_MAIN' OS = 'Windows_NT' ALLUSERSPROFILE = 'C:\Documents and Settings\All Users' ANT_HOME = 'C:\tools\apache-ant-1.7.1' HISTFILESIZE = '5000' TEMP = '/c/DOCUME~1/username/LOCALS~1/Temp' COMMONPROGRAMFILES = 'C:\Program Files\Common Files' CYGWIN_BIN = 'C:\tools\cygwin\bin' USERNAME = 'username' PROCESSOR_LEVEL = '15' PSModulePath = 'C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\' SHELLOPTS = 'braceexpand:emacs:hashall:histexpand:history:ignoreeof:interactive-comments:monitor:verbose:xtrace' FP_NO_HOST_CHECK = 'NO' SYSTEMDRIVE = 'C:' JAVA_HOME = 'C:\tools\jdk1.6.0_21' LANG = 'C.UTF-8' USERPROFILE = 'C:\Documents and Settings\username' CLIENTNAME = 'Console' PS1 = '\[\e]0;\w\a\]\n\[\e[32m\...@\h \[\e[33m\]\w\[\e[0m\]\n\$ ' LOGONSERVER = '\\VA-DC01' PROCESSOR_ARCHITECTURE = 'x86' !C: = 'C:\tools\cygwin\bin' DSB_PROFILES_SOURCED = 't' SHLVL = '1' USERDNSDOMAIN = 'SOMEDOMAIN.COM' PATHEXT = '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.PSC1' HOMEDRIVE = 'C:' ANT_ARGS = '-emacs -find build.xml' PROMPT = '$P$G' COMSPEC = 'C:\WINDOWS\system32\cmd.exe' TMP = '/c/DOCUME~1/username/LOCALS~1/Temp' SYSTEMROOT = 'C:\WINDOWS' USERNAME_BIN = 'C:\Username\bin' PRINTER = '\\VA-FS05\HP4200DTN' CVS_RSH = '/bin/ssh' PROCESSOR_REVISION = '0401' INFOPATH = '/usr/local/info:/usr/share/info:/usr/info:' PROGRAMFILES = 'C:\Program Files' NUMBER_OF_PROCESSORS = '2' SESSIONNAME = 'Console'