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


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


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