delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/01/03/09:20:42

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 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
Subject: Re: Bash scripts may misbehave if SHELLOPTS is exported and 'monitor' is enabled
References: <2fc802c00701030544h7b9e67a6qc18fad1edf71ca AT mail DOT gmail DOT com>
In-Reply-To: <2fc802c00701030544h7b9e67a6qc18fad1edf71ca@mail.gmail.com>
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 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 AT byu DOT 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/

- Raw text -


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