This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Bash scripts may misbehave if SHELLOPTS is exported and 'monitor' is enabled

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   
volunteer cygwin bash maintainer
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at
Comment: Using GnuPG with Mozilla -


Unsubscribe info:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]