From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 27551 invoked from network); 19 Oct 2022 08:27:13 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 19 Oct 2022 08:27:13 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1666168033; b=WBIT4FEFl50DH8xxj1pT37g12nxjHYjJim9bLWIqpeuLdzYV/Bp/pM60Is+jZpm/lNQv3f5ayV xBWNAcx/OsSScoPZd+lyjS09mUwd7wRQpBv18YI74lUme80ZgAwDJqC78ECyIAr8GVFwDakyTd TiLDMk/7hIaLI0sJeb3i6YlCuaa948o9qhkNhX5iMdQee04t6jTd/cQpq18w3dEXoyvMlZeQ8i uO4fPmdHPj4LgkgogVjFTBbrsX+D80X8HnnuZxg2tyS8a84jl8wHoXmb/NnSOdwKMfguM6yhmL ZXEtIRQ3wddZATYGL/16T3D/dBOAFQriDRd78EacnLI8WA==; ARC-Authentication-Results: i=1; zsh.org; iprev=fail smtp.remote-ip=37.120.193.124; dkim=pass header.d=national.shitposting.agency header.s=mail header.a=rsa-sha256; dmarc=none header.from=national.shitposting.agency; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1666168033; bh=5CEzEs4KT93MHt/cEeZd7F9tIu91sRb2b1yj5fnXYQk=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:DKIM-Signature:Date:DKIM-Signature; b=DC1kZp6cIX0ASFOR7+8IfpX5eXieTkcGxv/l6goOryprR4QcnWHP/596w/qVUBIc+fMGAOQ25I w14EgmRHfKUQVXe9uxIAVcxtyn/pOwqmdYtg7R5Nk8A8TIq9Kcv1hqyI7xZlIO+woVKUD6Ej4n vanUmEyFy1PVvrWbERQNGlpqecgljeyhKVa3soMBmExqSh5QKGod2B7M3ruAEK+gdaCpAgSTju ZMIdLVhyda6vbde4MS3/flZill8FCTg3Yq9dhgsotZneAfOt//6rqFB7BqHzunZM8HZOw2pskj iP0xdAFPFDpnsL20OiM738ghDcRFflXEFqf9rOyso6IJUA==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=g6T6lP5YyvX4P0uW1gqjarGtRLPH8PEBPnFHwefXDVY=; b=qx6JhmAxCpdIMPblAqqDt1TMYn mJNoLzlfhYqHGmVB95xsKkdoPaZiur1q1ryclCG3JVVeIiZKXNiWpBPx6N3XZf24ZS4RSUZXCUzVa WxMnQOPfTyjj+e2e1vNN06T7H9q6Fm6DrAQp2HBMGMKjK8Y8i92Aht8j1OEwQd6xmFfBtD4lCkaBD 6qBTBRBbcmYyQvRuY13fS4GJHLi9jUolSi5flMdUofBCSqf/N9iEy0VxRSaGSBhP+zQf0Anh7Nz2l u1Z8DTvpVVX/ptn9XJX7nakQzo7BXO12EOIL1iDCwx/Mzo15b+z92fLhz0/ojGhtmLvWAE4+Uc9YG BxD1Rxbg==; Received: by zero.zsh.org with local id 1ol4Pv-0004ms-R5; Wed, 19 Oct 2022 08:27:11 +0000 Authentication-Results: zsh.org; iprev=fail smtp.remote-ip=37.120.193.124; dkim=pass header.d=national.shitposting.agency header.s=mail header.a=rsa-sha256; dmarc=none header.from=national.shitposting.agency; arc=none Received: from [37.120.193.124] (port=35848 helo=mail.cock.li) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1ol4PJ-0004Qd-Je; Wed, 19 Oct 2022 08:26:36 +0000 Date: Wed, 19 Oct 2022 10:26:10 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=national.shitposting.agency; s=mail; t=1666167988; bh=5CEzEs4KT93MHt/cEeZd7F9tIu91sRb2b1yj5fnXYQk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Eo9KUSOiMQ/bZZjle4kHPEoUMhoDXLgrVUFUjRkuZMBSl7a6y5x9a36CYb+KtQdFd DyCD4bysZeuRElaii7yHSdo3Sb1VSd20pj7n1XWm+aBdgDpSfbbwLFoW8uCGGl95js iXPsXEDc2GvH60oDuNSKruVUhBLZFPyc2vA3R6asEk/rOOOk0/HmRXZXnsFQpEk8E+ qkk043c3IG9ChRvtTsLiubDy9ZAiqNMFZE5fY+pFtlD8uBq3VuPGRJjbClh8HwgAnD F7fFesQnNZ5pAbYqu+CpNXzny1X4qILS+BfSfhcPa10BC0c+ts/s1pKROOJAvg3viN ymG6rzyZZOs9A== From: zsugabubus@national.shitposting.agency To: Thomas Klausner Cc: zsh-workers@zsh.org Subject: Re: problem with 'ls | less' shell function Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Seq: 50791 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: On Mon, Oct 17, 2022 at 05:36:20PM +0200, Thomas Klausner wrote: > On Mon, Oct 17, 2022 at 04:50:20PM +0200, Mikael Magnusson wrote: > > On 10/17/22, Thomas Klausner wrote: > > > Hi! > > > > > > I recently noticed a problem in zsh 5.9 (as built from pkgsrc) on > > > NetBSD 9.99.100. Since I didn't notice it before it could be related > > > to a change in NetBSD (I'm following the latest version), but I've > > > been told that the issue can be reproduced on Ubuntu 19.04 and FreeBSD > > > 13.1 too; but not in zsh 5.8.1, nor in most other shells though. > > > > > > The discussion on the NetBSD mailing list can be read in this thread: > > > https://mail-index.netbsd.org/current-users/2022/10/12/msg043076.html > > > but I'll summarize the issue I see in zsh here. > > > > > > I have a shell function I've been using for ages: > > > > > > dir() { ls -al "$@" | less; } > > > > > > Recently, when I tried suspending this with CTRL-Z and then resuming > > > it with 'fg', I get: > > > > > > $ dir > > > (CTRL-Z) > > > zsh: done ls -al "$@" | > > > zsh: suspended > > > $ fg > > > [1] + done ls -al "$@" | > > > continued > > > zsh: done ls -al "$@" | > > > zsh: suspended (tty output) > > > zsh: done ls -al "$@" | > > > zsh: suspended (tty output) > > > > > > The same thing works in NetBSD's ksh: > > > > > > $ fg > > > ls -al "$@" | less > > > (CTRL-Z) > > > [1] + Done ls -al "$@" | > > > Stopped less > > > > > > or in bash > > > > > > $ fg > > > ls -al "$@" | less > > > (CTRL-Z) > > > > > > [1]+ Stopped ls -al "$@" | less > > > > > > If I use '/bin/ls' in the shell function instead of 'ls', it works > > > fine. > > > > > > Any ideas what the issue could be? > > > > The last bit implies that 'ls' is an alias or function, can you check > > the output of 'which ls'? > > No, it isn't: > > $ which ls > /bin/ls > $ type ls > ls is /bin/ls > > Compare to > > $ type ll > ll is an alias for ls -al > $ type dir > dir is a shell function from /home/wiz/.zshrc > > But I take back the statement that it works with /bin/ls in the dir > function definition, it shows the same broken behaviour. Not sure why > I thought it worked before, sorry for that red herring. > Thomas > I think what happens is that zsh fails to correctly set the foreground process group in `fg`. `less` is not in the foreground pgrp that's why it immediately gets suspended by SIGTTIN after it receives SIGCONT. In this example it is more obvious that `sleep` is not in the foreground pgrp (confirm with ps): $ f(){echo|sleep 60} $ f ^Z $ fg ^Z^Z^C^C^C^C^C^\ 15bf8ace168a86d0fae90b10e9f706baddd4c0bf is the first bad commit 50134: Tweak process group handling to prevent unkillable pipelines -- zsugabubus