bug-bash
[Top][All Lists]
Advanced

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

convoluted script causes bash to block unexpectedly


From: Iain Calder
Subject: convoluted script causes bash to block unexpectedly
Date: Fri, 10 Jun 2016 18:10:18 -0400

Configuration Information [Automatically generated, do not change]:
Machine: i486
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i486' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i486-pc-linux-gnu' 
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL 
-DHAVE_CONFIG_H   -I.  -I../bash -I../bash/include -I../bash/lib   -g -O2 -Wall
uname output: Linux hestia 2.6.32-5-686 #1 SMP Mon Jun 13 04:13:06 UTC 2011 
i686 GNU/Linux
Machine Type: i486-pc-linux-gnu

Bash Version: 4.1
Patch Level: 5
Release Status: release

Description:
        Under a convoluted sequence of events, bash blocks unexpectedly.
        Following is the minimum amount of code that can replicate the problem.
        See comments in code.

Repeat-By:
        #!/bin/bash
        ### demonstrate bug in bash(1):
        #
        # Problem replicated on:
        # * Ubuntu 7.04 (Feisty)  Linux 2.6.20-15  IBM ThinkPad P-III 1.1GHz
        #   GNU bash, version 3.2.13(1)-release (i486-pc-linux-gnu)
        #
        # * Debian 6.0 (Squeeze)  Linux 2.6.32-5-686  Dell P-II 400MHz
        #   GNU bash, version 4.1.5(1)-release (i486-pc-linux-gnu)


        while :; do                         # problem only occurs in a loop.
                eval 'command exec >/dev/null'   # both eval and command stms 
needed.
                #                                #   Target file choice matters 
not.
                exec >/bad  || exit              # script locks up at this exec
                #                                #   but only if followed by ||.

                echo >&2 finished;  break        # this line never reached.
                #                                #   Problem does manifest 
without it.
        done

Fix:
        I haven't tried fixing this.
        Also, I haven't tested on the latest version of bash.



reply via email to

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