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,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 24140 invoked from network); 29 Apr 2021 14:12:29 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 29 Apr 2021 14:12:29 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1619705549; b=Ob6vlqLBx8H/8ee/NP68Jllj2nSv21bH7NJeKvAgFRI4iTV9ONiL0KssT5b4zbTvfGJ7YhfMHe +azcSw54ssJrkq0v8+tcVl0RqZxtG9lfECYcs8gJbh57PVQI8U4iLBYeggAB4nbX2mE03t7L3f Omv640m6EwOHwAfZS9am8Q7o8fYU0HhaA673/R/lGcaQ2p+LdzFzWA5wJjk0pO/8j24+i3evqx 3ksqThtcQ5gEzSh8+iQBqOmJquhMDNcthc2XpIWMq5/OOk1nmTceekTE4wy+eWAIChkoZVQY9f w5Lb/8v7umxBf12yk8zImSTqs01oRlVu3VpVtD7PkbTvfg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (out1-smtp.messagingengine.com) smtp.remote-ip=66.111.4.25; dkim=pass header.d=daniel.shahaf.name header.s=fm3 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm2 header.a=rsa-sha256; dmarc=none header.from=daniel.shahaf.name; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1619705549; bh=UuXB2heb5XsI3k+kFhSgBHb79XEBMI79gVmNqXTwMhs=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:In-Reply-To:Content-Transfer-Encoding:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:DKIM-Signature: DKIM-Signature:DKIM-Signature; b=rAveWepqcU+qHB22faCzLNIY+6zubpuGnKWkhSjqbKXml4/M995DfWmxtvPsakVg78AFtJbEW6 jHkAAAwyIf7AOAcMfX423CDRUidvBTF42/+24gQ6DbSXKcRAX8oP5C3mhtRS3it3LkmnUNNg0Q vLbZK8tIcHPQY9y/bl093/3wSBttslp/hV4tet9Qh+hA1++kJthO70NHhHB7v43sOc7RhH1YQi NZS3zkIsVOq+fdiWpK9zLBiyqGwug/mMm8fz6nwaRIHHrit6a6+bfdpLQ4cyr1SeDWIecsSZDx cUozxV1dqXuTw02PXfq8iW4erG//4auK84Sh0VxkTP4M5Q==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:In-Reply-To:Content-Transfer-Encoding :Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID; bh=lqc6NJn1RqWuuCzzrDXqB07ouPEZFDYbBWd3FQegmTA=; b=ctgRTGQSC3N/vDJ70QCqRGX+nS r4sHVirv6gw5WtFLL9inlEgyXkDEaBFdNSVTnW2E+A2pEerK7XUuml1+/n4FzOc9jFyyMqAqWg0Dm 6gw/NA8BlCL91go6XGkRs7mewZFwNK6rV56526xT2cWy7fUg7LJvTmI9MZr9t7hFkT0XM9a9TWsjF ZgHKhLx0E6bUlnc4acLwzLfVE5KTkNYximusgQ7OlGNrblY2U3Ikt7pFLdunCrTR83sTnbXJoriEq BpDCVEXOL4f0h/rbeVn/1F6uA1+GA6jGRCnkpXvczZ6WL1Fuiq8orhz1LxWG1fTqmU2nicon8n1+x mG6pivYw==; Received: from authenticated user by zero.zsh.org with local id 1lc7P3-0007Jw-21; Thu, 29 Apr 2021 14:12:29 +0000 Authentication-Results: zsh.org; iprev=pass (out1-smtp.messagingengine.com) smtp.remote-ip=66.111.4.25; dkim=pass header.d=daniel.shahaf.name header.s=fm3 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm2 header.a=rsa-sha256; dmarc=none header.from=daniel.shahaf.name; arc=none Received: from out1-smtp.messagingengine.com ([66.111.4.25]:55335) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1lc7On-000749-Bi; Thu, 29 Apr 2021 14:12:13 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 3668E5C009C; Thu, 29 Apr 2021 10:12:12 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 29 Apr 2021 10:12:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=date:from:to:cc:subject:message-id :references:mime-version:content-type:content-transfer-encoding :in-reply-to; s=fm3; bh=lqc6NJn1RqWuuCzzrDXqB07ouPEZFDYbBWd3FQeg mTA=; b=mQ+g6inwVWTV6739O8VQq2yTwYm1TD4a9I8m1mfocRGgU/uwNbCYR30l CA0KW2j82sowcUg8Io/cq5OFxsrGm15dly2pJM8QnU4NCXf3kGcw5aqrY8m0uGS6 VkIXjcUREiOoi749je3c3UbnDnI2iQ4IdquUFpcPiM4fZPtDWeZhsXSXt+RJGVSu 1TAyFyFUKls5OEha8Ebd0pkPXHFnVH887YESnA+VrNDFRZsuNz53TPOf6JrCkOp1 z12f8CIZNZwlcHibI1QHjcxRwrxmvL0KhuETwBsR+8uuV4sd9lIrrQaQHJk5J+7P +acW16FCUXMsS8k7rpJ6nvV4mPSXpw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=lqc6NJn1RqWuuCzzrDXqB07ouPEZFDYbBWd3FQegm TA=; b=hMsCU81K4pLC/+0ViZos8XIf8b8g5AV1AHChB/im56zjOyMjnPV27TrfA jKP7VdxfLwGiqAbxqaoyD1B+W03Uw2fAvQ3k5ExC0kpZMZuNQggk6uu2p6EWYLn+ KjXtMpsKqNr7y3vJ2e7BIAkQBAphoxRuU+hnZVjyyhNtdbjSQCLaSVUK9+QYBr8p 1K/eb7otjuXCA8bbGtl724NYdcDVi2vA/IFjIBuGxKnG2JhA/gc5I8jyMPV2nC+w VngM3xmTMtFZNrCunv0J0O515KiHM938CD9viO5RKzINfCkNgorn2own8BxxNc5/ oLasiEUTiV7s4jOMz2m3XE9CRr3Dw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvddvgedgjeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtugfgjggfsehtkedttddtreejnecuhfhrohhmpeffrghn ihgvlhcuufhhrghhrghfuceougdrshesuggrnhhivghlrdhshhgrhhgrfhdrnhgrmhgvqe enucggtffrrghtthgvrhhnpefgkefgfeejgfdvvdfguddtleelkedvfeetiedtudfhveev veduhfdvveeffedvueenucfkphepuddtledrieeirdeifedrvdeftdenucevlhhushhtvg hrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegurdhssegurghnihgvlhdr shhhrghhrghfrdhnrghmvg X-ME-Proxy: Received: from tarpaulin.shahaf.local2 (bzq-109-66-63-230.red.bezeqint.net [109.66.63.230]) by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 29 Apr 2021 10:12:11 -0400 (EDT) Received: by tarpaulin.shahaf.local2 (Postfix, from userid 1005) id 4FWHWF0pc1z28V; Thu, 29 Apr 2021 14:12:09 +0000 (UTC) Date: Thu, 29 Apr 2021 14:12:09 +0000 From: Daniel Shahaf To: Marlon Richert Cc: Zsh hackers list Subject: Re: [RFC][PATCH] Add zrestart() Message-ID: <20210429141209.GG28063@tarpaulin.shahaf.local2> References: <20210426032200.GA26443@tarpaulin.shahaf.local2> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Seq: 48739 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: Marlon Richert wrote on Tue, Apr 27, 2021 at 14:37:30 +0300: > On Mon, Apr 26, 2021 at 10:29 PM Daniel Shahaf wrote: > > > > > + local err="$(zsh --interactive --monitor --zle -c '' 2>&1 > /dev/null)" > > > > > > > > Also, I think it's quite a stretch to describe this line as "_tests_ > > > > whether the shell is able to restart". > > > > > > > Care to comment about the part of my answer before the "Also", which you > > had snipped? > > Sure: > > On Mon, Apr 26, 2021 at 6:22 AM Daniel Shahaf wrote: > > > + local err="$(zsh --interactive --monitor --zle -c '' 2>&1 > /dev/null)" > > > > This doesn't necessarily restart the _same_ zsh, if there's more than > > one installed. > > I think your observation is correct and I was planning to fix it in > the next version of my patch. :) > > When I don't reply to a point you make, it means that I either agree > or think it's not worth arguing about, and I've put it on my TODO list > for the next version of my patch. I was trying to be brief and not > post a bunch of agrees/will-dos or quote unnecessarily. But if it's > prefered that I do respond to every point I agree with and/or quote > each part of every email I reply to, just let me know. :) When you don't respond to a point, it's not possible for the reviewer to distinguish the situation you describe from other situations — especially when, as in this instance, the fix isn't obvious. (proc(5) isn't portable, argv[0] can lie, etc..) So, it helps to be explicit. But so long as we're on this level of detail, it's also fair to just acknowledge once that all snipped points are agreed with and will be implemented. > > > I originally had `zsh -fn `, along the lines of what > > > was suggested earlier, but that test can fail on a valid dotfile that > > > uses dynamically named dirs. > > > > A minimal example of this would not be out of place. > > % zsh_directory_name() { [[ $2 == home ]] && reply=($HOME) } > % cd ~[home]; print $? > 0 > % print 'zsh_directory_name() { [[ $2 == home ]] && reply=($HOME) } > cd ~[home]' > tmp > % zsh -fn tmp > tmp:2: no directory expansion: ~[home] > % Thanks. Is this a bug or expected behaviour? > > > Plus, if any dotfile sources other files, > > > those files aren't checked this way at all. The approach above is the > > > only one I've found so far that appears to be completely reliable in > > > determining whether the shell can start up successfully. > > > > > > > This line executes a whole bunch of code you have no control over. > > > > > > It is, however, exactly the code we want to test here. > > > > I'm aware. However, you aren't "testing" it, you are *running* it. > > > > First, that means the docs are wrong. > > > > Second, that code might do things that are inappropriate for the use-case > > of "testing" the startup code. > > When you execute `make check`, does it not _run_ the code? It runs code that I wrote on data that I control in an isolated environment that takes care not to modify anything else on the system whereon the tests are run. > How else are you going to test it? :) The operative word here is "you". Whoever wrote the code is best placed to know how to test it. You don't know what the user's zshrc does, so how can you know whether it's safe to run it twice? > > Or, in other words: the trick is to throw the bathwater out and > > keep the baby. Keeping *both* the baby and the bathwater isn't an > > ideal solution. > > What exactly here is the "bathwater"? Side effects of the test. (The baby is the test's soundness and completeness.) > Would it help to mock out certain features in the subshell that you > wouldn't want to actually run in this test? Would it help to invoke > the subshell with -o RESTRICTED? That'd still let a zshrc run, say, «ssh foo lorem» or «date | tee -a my-login-log | read -r REPLY» [jumping through some hoops to avoid actual output redirections], which are both things that shouldn't be run twice. To be clear, these are just two examples. They are not exhausive.