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

X-Spam-Check-By: sourceware.org
Message-ID: <45AD9572.8000905@byu.net>
Date: Tue, 16 Jan 2007 20:18:10 -0700
From: Eric Blake <ebb9 AT byu DOT net>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.9) Gecko/20061207 Thunderbird/1.5.0.9 Mnenhy/0.7.4.666
MIME-Version: 1.0
To: cygwin AT cygwin DOT com, luke DOT kendall AT cisra DOT canon DOT com DOT au
Subject: Re: Changed handling of "!" in /bin/sh?
References: <20070117015312 DOT 43811842EF AT pessard DOT research DOT canon DOT com DOT au>
In-Reply-To: <20070117015312.43811842EF@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-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

-----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.

> 
> 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?

> 
> 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

> 
> 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.

> 
> 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.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             ebb9 AT byu DOT net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFrZVy84KuGfSFAYARAlDXAJ40BcktrqqE9cy+/h3evOpIPcYnWQCgtETx
U9HyPHcoWCC/3orb9KCPdaU=
=zx7J
-----END PGP SIGNATURE-----

--
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