From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19078 invoked by alias); 14 Jun 2017 22:43:53 -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: 41295 Received: (qmail 2919 invoked from network); 14 Jun 2017 22:43:53 -0000 X-Qmail-Scanner-Diagnostics: from mail-ua0-f174.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.217.174):SA:0(-0.0/5.0):. Processed in 1.607305 secs); 14 Jun 2017 22:43:53 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_PASS,T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: schaefer@brasslantern.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.217.174 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=VpMOq9yMfQJ44dQAQK7pqhGdAmqWrj1VkPycCgp7sy4=; b=Az+cF06AdYrUIZESTXOMbDLryb8+6JIR4KjNbuJHH0ZWGzo/8aWT04jGZAMacS1Q27 ZgOVaOoVngptkwS/4XCfkNmDxwO/IcIdm1f9OGZPj0xzFyd2QqEjDMs8ppFhcBJ1TLoL O79E7bba1xTM6Lory3qcfWZZocBnVV34NXfwulydZ6RbiupI2RYBjn13xlr/1Mgk/s+g RONLiWJmoNFwzvWF4Vu9VtzWG1KC70uyV5olFlTEeg8TSyo8FXgMeIW6B21BHumzK8Fm bzmRpRAMmhXCEPlaJx58gsbgBImjt4x41gBFp1nceWWqlK5b4sVLvYn4jL9Ui5sg275z 7C/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version; bh=VpMOq9yMfQJ44dQAQK7pqhGdAmqWrj1VkPycCgp7sy4=; b=qVvegmBJPST7DTYqtJkkI/5pm34hqnor6/HE++QnOUSbTlsYb3YqGfGYjkKFB0VGUG bY+pA0dLaYUJoYp5s5fO26Plb0kWpwR351byODCC4K6sBPPX33Zky6oVbGr/w0LoLFe/ XfenoM81vB8bXizfmEtArWrHC37Lyz1kxPEgXsQy2mvtnwVpqc3rMdBTwcXHWJjN0lvK QlS1UlRS+xqBb0zDBh8c93xLhN3KUiRwUIMosKMFN37e41mhyVWqZWH9VuksBaUYQY+o uCY0vuuWscYO36aebfsh1LIlwGH5danriOs5NcWmgOOlZghYqGXxta/qV84LrLT/84Ln z26w== X-Gm-Message-State: AKS2vOxS4i9FJ1c4xvniDmqpAjp2M3vBLzyj4+RTBlvdJPERA7WE0aN+ o9SYhFzlgYIfaSIHq44= X-Received: by 10.176.7.194 with SMTP id d2mr1509514uaf.61.1497480224773; Wed, 14 Jun 2017 15:43:44 -0700 (PDT) From: Bart Schaefer Message-Id: <170614154425.ZM20199@torch.brasslantern.com> Date: Wed, 14 Jun 2017 15:44:25 -0700 In-Reply-To: <20170612190218.GA12445@chaz.gmail.com> Comments: In reply to Stephane Chazelas "Re: [PATCH3] Re: avoid closed stdin() in zle widgets" (Jun 12, 8:02pm) References: <20170611182045.GA5318@chaz.gmail.com> <20170612060554.GA4709@chaz.gmail.com> <1497278089.1853864.1006670720.0A8DB74D@webmail.messagingengine.com> <20170612151042.GB3806@chaz.gmail.com> <20170612151902.GA19315@chaz.gmail.com> <1497281675.1868175.1006750384.46FA1223@webmail.messagingengine.com> <20170612190218.GA12445@chaz.gmail.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: "zsh-workers@zsh.org" Subject: Re: [PATCH3] Re: avoid closed stdin() in zle widgets MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Jun 12, 8:02pm, Stephane Chazelas wrote: } } My point is that a command should be able to reasonably make some } assumptions, like: } } - stdin should be open for at least reading } - stdout, stderr should be open for at least writing Although I understand the security implication of accidentally opening some other file onto fd 0/1/2, I can't agree with the above statements. Taken to the logical conclusion, the >&- <&- or 2>&- operators would be required always to fail with an error. It should not be the shell's job to plug this hole. I will agree that a valid argument is that the shell should not implicitly *open* this hole, which one could also argue is what the completion system had been doing in spite of the behavior being documented. However, with these two likely exceptions -- } - argv[0] should be set (argc > 0) } - no dups in the environment -- there is nothing else on your list where I would agree that the shell should ignore the user's directives in the name of protecting an external command from itself. } $ (limit stacksize 100k; zsh) } zsh: segmentation fault } zsh: segmentation fault } } (twice!?). Is that a bug? I believe what's happening is that both the zsh inside the subshell and the parent handling the subshell exit are reporting the error, so one failure / two messages. However, I can't test directly because I can start zsh -f with a hard limit stack size of *zero*, so I'm quite curious as to why you get a crash on 100k.