From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 11 12:52:02 2015 Received: (at submit) by debbugs.gnu.org; 11 Sep 2015 16:52:02 +0000 Received: from localhost ([127.0.0.1]:57158 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZaRYQ-0005rF-BE for submit@debbugs.gnu.org; Fri, 11 Sep 2015 12:52:02 -0400 Received: from eggs.gnu.org ([208.118.235.92]:35782) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZaRYN-0005qy-Lv for submit@debbugs.gnu.org; Fri, 11 Sep 2015 12:52:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZaRYM-00047o-PE for submit@debbugs.gnu.org; Fri, 11 Sep 2015 12:51:59 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:59928) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZaRYM-00047k-MS for submit@debbugs.gnu.org; Fri, 11 Sep 2015 12:51:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45783) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZaRYL-0004VW-RO for bug-grep@gnu.org; Fri, 11 Sep 2015 12:51:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZaRYG-00046W-OW for bug-grep@gnu.org; Fri, 11 Sep 2015 12:51:57 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:48432) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZaRYG-00045V-GG for bug-grep@gnu.org; Fri, 11 Sep 2015 12:51:52 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 84C4E161074 for ; Fri, 11 Sep 2015 09:51:50 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 5hHvJOsr7qbB for ; Fri, 11 Sep 2015 09:51:48 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id CCB5F161076 for ; Fri, 11 Sep 2015 09:51:48 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 5l4OVJeRNRxE for ; Fri, 11 Sep 2015 09:51:48 -0700 (PDT) Received: from [192.168.1.9] (pool-100-32-155-148.lsanca.fios.verizon.net [100.32.155.148]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 91D15161074 for ; Fri, 11 Sep 2015 09:51:48 -0700 (PDT) To: grep bugs From: Paul Eggert Subject: grep --color can leave terminal in weird state after signal Organization: UCLA Computer Science Department Message-ID: <55F306A3.5070405@cs.ucla.edu> Date: Fri, 11 Sep 2015 09:51:47 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) If grep --color is interrupted, either via ^C or ^Z or some other signal, it can leave the output terminal in a weird state. This problem was noted by Giuseppe Scrivano in and I'm forwarding the report here. One fix would be to do what GNU 'ls' does; note that SIGTSTP must be treated specially so that the color state resumes after restart; also, the signal handler just sets a flag that is polled periodically by the main code.