X-Spam-Check-By: sourceware.org
Message-ID: <459BBBD4.4000906@byu.net>
Date: Wed, 03 Jan 2007 07:21:08 -0700
From: Eric Blake <ebb9@byu.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@cygwin.com
Subject: Re: Bash scripts may misbehave if SHELLOPTS is exported and 'monitor'  is enabled
References: <2fc802c00701030544h7b9e67a6qc18fad1edf71ca@mail.gmail.com>
In-Reply-To: <2fc802c00701030544h7b9e67a6qc18fad1edf71ca@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to David Picton on 1/3/2007 6:44 AM:
> It turned out that the problem has something to do with the 'monitor'
> option being enabled.  Normally it would be turned off in
> noninteractive scripts, but if SHELLOPTS is in the environment the
> setting (turned on by interactive shells) gets propagated to all
> shells.

Correct.  The propagation of SHELLOPTS from an interactive to script
environment makes scripts behave much more interactively, which they
generally do not expect.  I'll look into seeing if it is worth teaching
bash that certain SHELLOPTS should be ignored in a non-interactive setting
(it seems like emacs, vi, histexpand, history, ignoreeof, and notify also
might qualify).

> 
> The bug disappears if:
> 
> 1.  I keep SHELLOPTS out of the environment, or
> 
> 2.  I change /bin/nroff to use /bin/ash instead of /bin/bash, or
> 
> 3.  I disable the monitor option (set +o monitor) before invoking man

All good workarounds; maybe when I next release bash I should be more
clear that exporting SHELLOPTS should be reserved for something done in a
top-level shell script that invokes other shell scripts, rather than in an
interactive session that invokes shell scripts, since exporting
interactive options to shell scripts has surprising effects.

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

Eric Blake             ebb9@byu.net
volunteer cygwin bash maintainer
-----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

iD8DBQFFm7vU84KuGfSFAYARAubeAKCkBBmKGC9VQ+Io5ABz7VYHvYGIpACgiY9s
h0r29anP6zLgGOl/o49UM10=
=hdJ1
-----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/

