bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Unbound variables in here-documents in dotted scripts


From: tonyg
Subject: Unbound variables in here-documents in dotted scripts
Date: 10 Nov 2000 06:40:25 -0000

Configuration Information [Automatically generated, do not change]:
Machine: i686
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' 
-DCONF_VENDOR='pc' -DSHELL -DHAVE_CONFIG_H  -D_FILE_OFFSET_BITS=64  -I.  -I. 
-I./include -I./lib -I/home/tonyg/rrr/bash-2.04/../include -g -O2
uname output: Linux death 2.2.12-20 #1 Mon Sep 27 10:40:35 EDT 1999 i686 unknown
Machine Type: i686-pc-linux-gnu

Bash Version: 2.04
Patch Level: 0
Release Status: release

Description:

When, at the shell prompt, dotting in a snippet of code that
        * has "set -u" in effect
        * includes a here-document, which...
        * ... refers to the value of an unbound variable

... bash responds (in various versions) with different kinds of crash.

Version "GNU bash, version 1.14.7(1)", distributed with RedHat Linux
6.1 for i386, responds by invoking bashbug automatically. You can't
see the error text from the shell itself.

Version "GNU bash, version 2.04.0(1)-release (i686-pc-linux-gnu)",
built from sources on RedHat Linux 6.1 for i386 using my own compile
of gcc 2.95.2, prints out the following:

        death:~/rrr/bash-2.04$ . ~/demonstrate-bashbug 
        bash: UNBOUND_VAR: unbound variable
        free: called with already freed block argument
        Stopping myself...Aborted (core dumped)
        death:~/rrr/bash-2.04$

Version "GNU bash, version 2.03.0(1)-release (hppa1.0-hp-hpux10.20)"
responds with:

        hp1:~$ bash --version
        GNU bash, version 2.03.0(1)-release (hppa1.0-hp-hpux10.20)
        Copyright 1998 Free Software Foundation, Inc.
        hp1:~$ . demonstrate-bashbug 
        bash: UNBOUND_VAR: unbound variable
        free: called with already freed block argument
        Report this to address@hidden
        Stopping myself...ABORT instruction (core dumped)
        hp1:~$

In all cases, the snippet "demonstrate-bashbug" was used, which
contains the lines:

        set -u
        cat <<EOF
        $UNBOUND_VAR
        EOF

Repeat-By:
        * create demonstrate-bashbug as per information above
        * run, at your shell prompt:

                $ . demonstrate-bashbug



reply via email to

[Prev in Thread] Current Thread [Next in Thread]