From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8859 invoked by alias); 2 Nov 2015 10:10:27 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 37051 Received: (qmail 25504 invoked from network); 2 Nov 2015 10:10:26 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.0 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=secretsauce.net; h=content-type:date:from:message-id:mime-version:subject:to :x-sasl-enc:x-sasl-enc; s=mesmtp; bh=OyrLLC1xSFdqppVcpPh78k7z5s8 =; b=ekx2FTVvJNBBUiruqVqynsJTsuiGUS53z53ByrY5HMiE6DkWPh8cFp/m5eX LHLuz1TWg2RQO47cQi9O6zdLZpuGEOw+heIc6DQpH2+Zqqh8p5if0NlxAOwqWtal /Z1BewS6z9w2nMh1fxUqQYpCvW6A4TG7JdE3TaiNBR1ARFi0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:message-id :mime-version:subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=Oy rLLC1xSFdqppVcpPh78k7z5s8=; b=hQRq4ugDKaNIxl6ZXYnXBLw0+jBRTly5wX KXx7akW4rvq4l5G1H9/NYPI5bGqTq6FFv0MGd50cvw8piPtQuOD46nube8WUfPnj Dw45Y4/qbPzS4KLjQW3YfLvNes9yIds3q64/HmMbXxcGNgbuNHZgVGAS8sRfUELE EKWkZRNkU= X-Sasl-enc: 7YJkyY45aE6owkLhP4Qp9aUCmmmxecIBEj8nbk1uWonj 1446459025 From: Dima Kogan To: zsh-workers Subject: Possible bug in signal handling Date: Mon, 02 Nov 2015 02:10:24 -0800 Message-ID: <87wpu0g19r.fsf@secretsauce.net> MIME-Version: 1.0 Content-Type: text/plain Hi. I'm seeing a suspicious behavior in zsh that isn't present in bash or dash. I'm not 100% sure the way this is supposed to work, so maybe zsh is still correct here, but filing this report just in case. The behavior is concerned with the user invoking a pipeline in zsh, then hitting Ctrl-C to kill it. One of the processes in the pipeline overrides SIGINT to ignore the first Ctrl-C; I would expect all the processes in the pipeline to die at the first Ctrl-C, except the overriding process. I would expect zsh to recognize the one still-alive process, and to not put up another prompt. When the user hits Ctrl-C a second time, the overriding process dies in response, and zsh should detect this, and prompt for a new command. This does happen most of the time in zsh, but I'm hitting a case where it doesn't: I have a /tmp/tst.sh script: awk '{print; fflush()}' | \ perl -e 'BEGIN { $SIG{INT} = sub { $SIG{INT} = undef; }; } while(<>) {sleep 1;} sleep 10000;' This script has a pass-through awk feeding a perl command that overrides SIGINT, and ignores the first SIGINT that comes in. I invoke this script thusly: $ seq 5000 | perl -nE 'say "xxx"; sleep(1)' | zsh /tmp/tst.sh So it's a mostly do-nothing pipeline. When the user hits Ctrl-C the first time, I expect everything but the inner zsh and the inner perl processes to die, and the outer zsh to NOT display another prompt until a second Ctrl-C. Instead I see everything except the inner perl die (inner zsh dies too), and the prompt is returned immediately. This effectively disowns the inner perl, so it cannot be killed interactively. If I replace the inner zsh with bash or dash, things work the way I expect. Things also work the way I expect if I get rid of the awk or if I get rid of the inner zsh, putting the whole pipeline on the commandline. Is this a zsh bug? If not a bug, can this be made to work the way I expect it to? Thanks! This is a bit convoluted, but hopefully it was clear enough. dima