bug-bash
[Top][All Lists]
Advanced

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

Re: bash unresponsive after Ctrl-Z interrupts a backquoted command


From: Chet Ramey
Subject: Re: bash unresponsive after Ctrl-Z interrupts a backquoted command
Date: Wed, 02 Jul 2008 09:51:21 -0400
User-agent: Thunderbird 2.0.0.14 (Macintosh/20080421)

Bruno Haible wrote:
Hi,

This command takes about 2 seconds to complete (on a slow machine; you can
make it a triple loop for a faster machine):

foo=`rm -f empty; touch empty; \
     for a in 0 1 2 3 4 5 6 7 8 9 ; do \
       for b in 0 1 2 3 4 5 6 7 8 9 ; do \
         echo g$a$b | cat; \
       done; \
     done | LC_ALL=C uniq -d`

When in bash-3.2.33, I run this command interactively (copy&paste), it
completes fine. When I interrupt it through Ctrl-Z, the CPU consumption
goes down but bash does not issue a prompt and does not respond to keypresses
such as Ctrl-Z nor Ctrl-C.

In fact, the 'echo' (bash), 'cat', 'uniq -d' processes are stopped. But I need
another shell to find out about. This is not very user-friendly.

This is a tough one.  It's hard to decide what the right thing is.

Variable assignment and especially command substitution are inherently
synchronous operations.  The shell is required to wait for the command
running the command substitution to complete.

The commands in the command substitution stop upon receipt of the SIGTSTP,
as they should.  The interactive parent shell ignores the SIGTSTP, as it
should. But the parent also continues to wait for the command substitution. The command containing the variable assignment is not a
`job', so the shell doesn't have a handle to manipulate it.

Chet

--
``The lyf so short, the craft so long to lerne.'' - Chaucer

Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/




reply via email to

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