delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/01/16/23:17:42

X-Spam-Check-By: sourceware.org
Date: Wed, 17 Jan 2007 15:17:15 +1100 (EST)
From: Luke Kendall <luke DOT kendall AT cisra DOT canon DOT com DOT au>
Subject: Re: Changed handling of "!" in /bin/sh?
To: cygwin <cygwin AT cygwin DOT com>
In-Reply-To: <45AD9572.8000905@byu.net>
MIME-Version: 1.0
Message-Id: <20070117041716.2D3C7842EF@pessard.research.canon.com.au>
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

On 16 Jan, Eric Blake wrote:
>  -----BEGIN PGP SIGNED MESSAGE-----
>  Hash: SHA1
>  
>  According to Luke Kendall on 1/16/2007 6:53 PM:
> > Do you mean, like adding set +o history into /etc/profile?  Er, but
> > that would turn it off for interactive use.  And if I set igncr so that
> > everything can see it then it has a side effect of exporting the
> > SHELLOPTS, so then the automatically set options are of course in the
> > env so they affect every sub shell.
> > 
> > Ouch!
> > 
> > It seems like I'm in a catch 22 situation.
>  
>  Yes, unless I can come up with a patch that makes bash smarter about which
>  SHELLOPTS options it will pay attention to when started non-interactively.

Okay, then I understand.

But you've also given us two or three other solutions, too!

> > I have "\\samba\x" mounted as "X:", a textmode mount.  But (to avoid
> > having "x:/cygnus" in my ":"-separated PATH), I have "//samba/x/cygnus"
> > in my PATH.
>  
>  Why not put /cygdrive/x/cygnus in your path, then?

Good question! :-)  It's mainly because we might use other Unix
environments too (Uwin or MKS or MS SFU <shudder>), and we'd like
everything as far as possible to use common names.  

> > Sorry, let me see if I understand.  We want igncr enabled, not disabled
> > (or the text mount idea above).  By developer tools do you mean all the
> > scripts?  I just read up on BASH_ENV: so I could have its script say:
> > 
> >     if expr "$-" : ".*i" > /dev/null
> >     then
> > 	:
> >     else
> > 	set +o history
> >     fi
>  
>  Or, more efficiently (fewer processes, and fewer lines):
>  
>  case $- in *i*) ;; *) set +o history ; esac

Neat!

> > Or, copy /bin/ash.exe to replace /bin/sh.exe.
>  
>  Not recommended.  The reason cygwin moved to bash as /bin/sh was to avoid
>  ash bugs.

Okay, so that's out.

> > Please let me restate, to check I understand what you mean by "you ran
> > bash interactively first": you simply  mean, I started an interactive shell?
> > (So that sees SHELLOPTS in the env because I put it there, then
> > the interactive shell options get set, which conflict with POSIX.)
>  
>  Yes - the fact that you ran bash interactively, and from that shell
>  started the non-interactive scripts, explains why the non-interactive
>  scripts inherited the SHELLOPTS set with interactive options.
>  
>  >>  
>  >>  If you use /bin/sh as your login shell, then fewer options will be set in
>  >>  SHELLOPTS automatically.
> > 
> > Do you mean, change /etc/passwd so it's /bin/sh, and then change .profile
> > to exec bash?
>  
>  Or even change cygwin.bat to invoke sh instead of bash, if you use the
>  default cygwin.bat created when you installed cygwin.
>  
> > 
> > Anyway, I think I now have a few workarounds, thanks to your patient
> > explanations.
>  
>  I hope that the BASH_ENV option works out for you.  I personally don't use
>  CRLF line endings, so I don't have to worry about igncr in my daily use.

I'm actually planning to make sure all the PATH elements are mounted
text mode, since it seems more efficient (since there'd be a little
less overhead in forking shells).

Thanks again,

luke


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019