X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,KHOP_THREADED,NML_ADSP_CUSTOM_MED,RP_MATCHES_RCVD,SPF_HELO_PASS,TW_HR X-Spam-Check-By: sourceware.org To: cygwin AT cygwin DOT com From: Andy Subject: Re: Debug the skipping of .bashrc when bang out from vim PC version Date: Tue, 28 Aug 2012 04:44:18 +0000 (UTC) Lines: 85 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit User-Agent: Loom/3.14 (http://gmane.org/) X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: 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 On Aug 27, 1:55 am, AndyHancock wrote: > It is often more covenient to use the Windows install of gvim than > to fire up Cygwin's X-windows to run the Cygwin version of gvim. In > order to be able to bang out to run bash commands, I have this in my > vimrc: > > shell=c:\cygwin\bin\bash.exe\ -i > > This allows me to do things like > > !!ls > > or > > :w !cat > > However, this only works when I launch the Windows version of gvim > from my Administrator account. When I try those commands from a > non-administrator account, I get: > > shell return 127 bash: ls: command not found > > or > > shell return 127 bash: cat: command not found > > It actually took a while to recognize this pattern with the > administrator account. I thought it would be simple to track down > the cause after finding this. I thought I could simply set > > shell=c:\cygwin\bin\bash.exe\ -i\ -v > > Then I could do echo the results of the shell-outs to register a and > paste them somewhere: > > :redir @a > !!ls > :w !cat > :redir END > > I confirmed that > > c:\cygwin\bin\bash.exe -i -v > > actually echos every gruesome detail by issuing it from the command > line. However, setting vim's "shell" option to include the -v > option *doesn't* seem to echo all the gruesome details regardless of > whether I use an administrator or non-administrator account. > > 1. Can anyone suggest a cause and/or solution to the inability of > the non-administrator to shell out? > > 2. What about why the -v option doesn't seem to work when included > in vim's shell option? > > 3. Can anyone suggest another way to troubleshoot the inability of > the non-administrator account to shell out? Here's some more information. Both accounts have the same .bashrc, which sets the $PATH. I rely on the -i option supplied to the bash command to force the execution of .bashrc. I was hoping that the -v command would show me that .bashrc was running by echoing the statements, but it doesn't. I even put in echo Running bashrc in the .bashrc, but no message shows (and no such text is sent to vim register a). Another confirmation that .bashrc is not being executed is that I shell out with !!echo $PATH and the path is the same as "echo %PATH%" issued from a DOS prompt. Here is another test that I tried. Logged in under the non-administrator account, I ran the PC-based gvim as LocalAdmin. That alone does not allow shelling out, even though I am prompted for LocalAdmin's password when launching gvim. I had to run gvim with elevated privileges before I could shell out. This entails running as Administrator (not as LocalAdmin, though the process still invokes an authentication window for LocalAdmin's password). Only then would !!echo $PATH give the path set by bashrc. Otherwise, it gives a path that is identical to %PATH% in a DOS shell. -- 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