delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/01/03/08:44:56

X-Spam-Check-By: sourceware.org
Message-ID: <2fc802c00701030544h7b9e67a6qc18fad1edf71ca@mail.gmail.com>
Date: Wed, 3 Jan 2007 13:44:36 +0000
From: "David Picton" <djpicton AT gmail DOT com>
To: cygwin AT cygwin DOT com
Subject: Bash scripts may misbehave if SHELLOPTS is exported and 'monitor' is enabled
MIME-Version: 1.0
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

I have noticed that a few scripts misbehave if SHELLOPTS is exported,
or defined in the environment before bash is first invoked.   (I had
set SHELLOPTS=igncr in the system environment - but I've backed this
out to avoid the problems).  The
problems seem to be caused by incorrect signal handling.

In particular, the current version of 'man' crashes with a strange message:

$ man bash
DESCRIPTION
       Bash  is  an  sh-compatible  command language interpreter that executes
       commands read from the standard input or from a file.  Bash also incor-
       porates useful features from the Korn and C shells (ksh and csh).

       Bash  is  intended  to  be a conformant implementation of the Shell and
       Utilities portion  of  the  IEEE  POSIX  specification  (IEEE  Standard
       1003.1).  Bash can be configured to be POSIX-conformant by default.
:
[1]+  Stopped(SIGTTIN)        ( cd "/usr/share/man" && ( echo ".pl 1100i"; /usr/
bin/cat '/usr/share/man/man1/bash.1'; echo ".\\\""; echo ".pl \n(nlu+10" ) | /us
r/bin/tbl | /usr/bin/nroff -Tlatin1 -mandoc | /usr/bin/less -isrR )
Error executing formatting or display command.
System command (cd "/usr/share/man" && (echo ".pl 1100i"; /usr/bin/cat '/usr/sha
re/man/man1/bash.1'; echo ".\\\""; echo ".pl \n(nlu+10") | /usr/bin/tbl | /usr/b
in/nroff -Tlatin1 -mandoc | /usr/bin/less -isrR) exited with status 38144.
No manual entry for bash

(I tested this on a fresh installation of the Cygwin base packages, so
I'm reasonably
sure that other people will be able to reproduce it!  I've reproduced
it on two machines, both running Windows XP Professional.  Note that I
have to type 'stty sane' to restore normal terminal operation after
the bug has occurred.)

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.

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

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