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,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 2319 invoked from network); 6 Mar 2023 01:33:47 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 6 Mar 2023 01:33:47 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1678066427; b=Bwbk0UMnHxw1uympmJxv6Ob4K3l2cvH9P+yhy1Lfmlj8tywHSlFyxnj8hB9jGlHm1fJjk7nJ7y pPR2EQYAH/l7Gp5ZR0iyXWp7yKDi84SjVbNzjXT4a3gY31B9oDjl7f4lRAMK3bTOsksmQU5vOR mQPhI6XFg4iBwm96WzET21Sa100M7/AhDqQoFd7z8JHMnUSOgZ5k2s0+b/BG4rnJs6msKGOA9/ nV7EzA3SC1pGNxAfpOic3Ofwh45UzoeyG1ILWISYiy48fPzeZv0A3tK6s4OCSPca21L7c+jkxe CUulMQNmaPDvtX0TcvxSazyV+Ebpnl09jI6HJWiP6QaCFw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-yb1-f181.google.com) smtp.remote-ip=209.85.219.181; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1678066427; bh=kD9Z6sfyAQJ+a+AQi/sC1zZvQyErkFG5a+S80UREmGQ=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:To:Subject:Message-ID:Date:From:MIME-Version: DKIM-Signature:DKIM-Signature; b=gIMRMIYH24OqCEkevBWH/b/NL0iaCPlLL0k5dRg0PbuLLtf1kvNVoZT1zhZGTfRUdUtkhRxeql wgqqUpbIol/Uq0ba41czG9VUdTkFckzD4wnNUsGt+h18TPpyPSIeI7067G3QOKLC+NTEjSIjBn kJLTPYD5KzZcCUAfaEBEF/wF7UwqBIB2vCtCFxKSUBD2gdnw83UCze8E7T5QZeYHxsogy1KGK+ ChQ+pjYfLbUQcWxj+zNWI6r7XZ421VaRg5EUNVSYtAqqk2zn2ex42BPqsefuY3AmVTWl68V+b7 DnZCKk3aQHc7x82gfqLYIQcPlYgfKTC3Whs/VUTdglm6XQ==; 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:Content-Type:To:Subject:Message-ID: Date:From:MIME-Version:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References; bh=PVdUE5xLpA4oWNfHRD+Ilwds+ofdHP+JI4MzArOM2KI=; b=P2MlTPzJOnaPVaNNsdstQ9GT7x SwlROd6zeGWpYXkdwWGHqvBQwz8toHn0aMQG9YlzBog41CoY7afs+FWLchEaEe/3zeghV5d7F3BKA ICCW7V6Dt1wtTJ9xbFG7KSev+xUxNmXSa0Ef8QlpaVFqnML5tdj0PAVCaBZZBSajrdEJkUr2+Bfqz 5VHW2PbCNpMRNznxLBGNOVkNBEdJft3JwdU/MGs2FmPt9UqqwaBBstIJbj8Dzpv7iLzik09Wl+and nzxfAAHMHI1y1Ao+MGrLowJ93MQb9kEwIAR4b+YszIlL72JMAKk6ccNcaytiI1nBbDxHdNwkiXYwS Ld5mWcQg==; Received: by zero.zsh.org with local id 1pYzjX-000GWk-1z; Mon, 06 Mar 2023 01:33:47 +0000 Authentication-Results: zsh.org; iprev=pass (mail-yb1-f181.google.com) smtp.remote-ip=209.85.219.181; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-yb1-f181.google.com ([209.85.219.181]:41742) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1pYziv-000GDB-Gf; Mon, 06 Mar 2023 01:33:10 +0000 Received: by mail-yb1-f181.google.com with SMTP id i6so6663500ybu.8 for ; Sun, 05 Mar 2023 17:33:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=PVdUE5xLpA4oWNfHRD+Ilwds+ofdHP+JI4MzArOM2KI=; b=FNQMN5EBLp9AOirnWoBUoPY1H1zzJnvZVxp7QCO+8OGlzeud10LX05mPMmM5u4vXqD fLi+aSPKtwYcMtDT9/yt1jQXgUEik2R0hfpY8HukHyFCWp00YfGGrgZu7Hyrkat5wDdh fMlASzcsrBFHthJA6UpKGMosRLYvMycQI7mCez0a3GQ/9oHdReMAhbT5AD211taVZfGu Meff2tYUPqTE62UOQubSpfoLsSiSKHRZBahAXW2HZrgLCZmSqqK9HSzLy28AK1yz6w+q R8OX70K9BYcA5RcTWpJXPf97WZNAtK6Qb16lc12HvhatEy0L0GFHD4pFWn6HHyhALZOJ ypTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=PVdUE5xLpA4oWNfHRD+Ilwds+ofdHP+JI4MzArOM2KI=; b=HFKs8bPfRHEXX6vsvE/SZaaqubBeKW7tTvuZ4T8O1z71MjJZqpeEcg55z7mLoyzf4h b2EE1ShXDAxW8+Xvbcp6AzHyPvC9MmzgwmObYA4UqRvf1a1YMdJ/nTi7FV0bxIsVsyWz VXsDW+vklnfUJEg4NwN6GLeIa/XENkgAyJegfccuaTkqexcpaWjkYx2pRR6FNthGYziM 5IqxrKFmDRHnIpaZnE00DGlCQix48Wm1PABEE0XjJlrBMXkX2AsIgKX9QcOvzETYpiAz oOzxHovgkMWB4E0SH/vVP1mZTDHPNyoKrpHoORP98jFwoxJmqG1UWFbJfk1CEvRrNWhG erUg== X-Gm-Message-State: AO0yUKU7xCxRVpSpXA+T3WY3obSYSQF1qBq0vob3z6aC/t1+LWRv6fdg anHRhlcUgtYM+/f70AeuiRq3I5umJBpAwg8pZVtheb5atDs= X-Google-Smtp-Source: AK7set9hcXJjywaNJ/+VFHLauH1BQ1s3sd/JwppmKj/oZuW+368+eDrFiwCJOXHTWh6jVO21iKz/Fvlc0Jka1k++SgY= X-Received: by 2002:a5b:d11:0:b0:a27:40c4:e12c with SMTP id y17-20020a5b0d11000000b00a2740c4e12cmr3404285ybp.2.1678066387881; Sun, 05 Mar 2023 17:33:07 -0800 (PST) MIME-Version: 1.0 From: Felipe Contreras Date: Sun, 5 Mar 2023 19:32:56 -0600 Message-ID: Subject: Weird bug / missing feature with gvim interaction To: Zsh hackers list Content-Type: text/plain; charset="UTF-8" X-Seq: 51513 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: Hi, I've been investigating for a while a weird interaction with vim and zsh, and this is the closest I've gotten to narrowing down the problem. Essentially this doesn't work: vim -g -c 'set shelltemp' -c ':!xdg-open "https://google.com"' The reason it doesn't work is that xdg-open immediately spawns a fork, which is why this doesn't work either: vim -g -c 'set shelltemp' -c ':!touch /tmp/fork-cur &' But that actually works in bash. The two key lines of code from vim are: setsid(); ioctl(slave, TIOCSCTTY, NULL); If I remove those, the code works fine, but then it doesn't work with sudo: vim -g -c 'set shelltemp' -c ':!sudo touch /tmp/sudo &' But it does with bash. It is a bit overwhelming, since there are many combinations: {bash,zsh}{sudo,fork}{sid,} But long story short, there's a combination that works with bash, but there isn't a single one that works with zsh. I wrote a program to be able to test this behavior outside of vim, and I can reproduce the problem [1]. The two combinations that don't work with zsh are: 1. sudo without setsid (the program cannot feed input into sudo) 2. fork with setsid (the grandchilds are sent SIGHUP) This is beyond my expertise, but I've tried my best to narrow down the problem. Is there any way to solve this in zsh? Cheers. [1] https://gist.githubusercontent.com/felipec/8a820f3dbf67a5861491553e211400fb/raw/e7f537c0b5b5f4d742f90cfac5f7f046ea61d438/pty-test.c -- Felipe Contreras