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, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 15162 invoked from network); 26 Apr 2021 19:04:29 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 26 Apr 2021 19:04:29 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1619463869; b=XjAqAvMdgC8jiI6TPDc2D0r+ayOHkXFA3yNii3Yp6RnbG3NyDLNt0//ADiHWJTdoznMFTQF8CP iWAxhocE7opwMD7dA8Tf0w1/XaefIx9Hcmcl/qUodQAGtVgnkjHfOAINz/t2HZojyQ0XpAQUKb RQ1/RFHqIZ24CaCbx7VUvErE2xozu60Ur5w/JoQoHRTM2FDkJ1LJx5sQ85HVJ5WHZ7dEEHG0wz qSaMFHWThJAmUdLYY4RW9YBsCvUPgFS6iueqrzQpTsM+SU+XfVf/XNc/RPXR1urQWBlcs0BoEP N1H6W3D53TITTTFzI3qpSbUNwD+wcjK5ZLm4YYxrUHH2rw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-lf1-f54.google.com) smtp.remote-ip=209.85.167.54; dkim=pass header.d=gmail.com header.s=20161025 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-20200801; t=1619463869; bh=IfEIB0YJ3j+rmvf7bHqADwO8GSXZ7wiDdLFlMe6ENvk=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=NmRoqSL1Oe9ts5ubIxyqPzFACZDbJQzWI60JIzFpOtmyEuxBhvbqTn8PR74ujHFvzjuoobfEaB f4cfFubxKAyL/b51agLifFjVAdpsj5JXIBumCR3cg2ZcFkpYuGz4HfsYn0QJTe49jq0s45xuqQ woL5UE+Chj/6HMJUkK/gBbrRQS3MvAJKfwcIqEv7SP1FRvwQ22W6HM9twDub7oyyLe3nTChQLC 2xYWHpr4eimRUpaJJX57dW4sG/nRbBre5+khT2Kh3Jol8kZX6g2WrSD4/m7DJSm01u4DVXyH7a 28/Ax64SyWMZGkT6iuio658dgk5FP3bYhesKqf05t08smQ==; 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:Content-Type:Cc:To:Subject:Message-ID :Date:From:In-Reply-To:References:MIME-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=7J6fFSaU3UiJ4jHib2AG3tCzVwUBvgHiFuFmP+ZrgeQ=; b=pIRYIMLLldHsEzj/wI5WK5L09A wf5DfSriMuuoGqFl2u3P9b+d12rwI9jYfE+y2VqIO4fxsrL19muy4Gh8iYAYUSV9HE9MhQlNrh3Kl gfDP38EYFdMql33baY+LXs1UvM3+pMuu17S4LZ6kUQ0Qm8IMR1xSoot5Kml1EoGL8V+KKKYUl9/VG 2fhwj+71wP75rZucCpTB8hw00K7oAZHD0aU19wAusGirhEn5dHxDbRJ4HMZBITmtDHH10/Qo+hRyz ayJ+xYXZQSqzQICtuVQMAhzTGrii58ma0pFHZQSkCZxQNYu3uEMAjKBSp2wssAn722yuuA+6UtV5R IoKhi4vA==; Received: from authenticated user by zero.zsh.org with local id 1lb6Wx-000IHC-AV; Mon, 26 Apr 2021 19:04:27 +0000 Authentication-Results: zsh.org; iprev=pass (mail-lf1-f54.google.com) smtp.remote-ip=209.85.167.54; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-lf1-f54.google.com ([209.85.167.54]:42707) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1lb6Wg-000I3H-HH; Mon, 26 Apr 2021 19:04:11 +0000 Received: by mail-lf1-f54.google.com with SMTP id d27so33046488lfv.9 for ; Mon, 26 Apr 2021 12:04:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=7J6fFSaU3UiJ4jHib2AG3tCzVwUBvgHiFuFmP+ZrgeQ=; b=ccS5c/e4yOpVEl/CqLhbg8I22Aa5b0ZentUYFJurtqTSy4FlTrIASq3/Wc9ovi1cxp /b9ZsOuyNGVsktZ+74qxKjOW8Tgey2+p64i8nEVM7dCn9sAWOrYptW/qiMnE3M+kGIOh TjpaF1q+wr79iV5c3WcYm0nw8ZnMUat2SdXQCdhNOOW0re44fbNO7uo1hCwCs2sAoZVL 6nuHw0jJQqAnEUx4gLg10sy3nhj36ooFuwqIpdQS8PVLebHDAiyZiWpPgkhI0CBeB75y PDMvewBSLRXqhNz1hkpr+21ZQ9WgZZr3LWSCidzGJIq2UFHe8HTooWiq9XDvIgFDOEJf HwiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=7J6fFSaU3UiJ4jHib2AG3tCzVwUBvgHiFuFmP+ZrgeQ=; b=YDOqRncxCzhA+/SoaiLChclb5fGwFNOztFzAtSGKiqL6fYLteGevRkH8yVny6SgmO5 L9P13uQM9dREfFcj5T6p/BrVDnGGtLY8SNdo1jlnefcyUdpHpgHbtHkgQIxiv0hEO/IB fP/vAGTuCy4sQu99znpYGVeg4riPg6K9dSURt2liYDCQwXcSi2CTeP5GNyNZWibr9kTa iCALEDHSxw13IblMNEs/cfJneraiL5qkDCBrzYdoVz7ORktfIWAo4stR+qT1apEZ2hm7 DUYTj4FYtpRO8cIrHP9R3mWd3pjypt7jlAczdagxNhk7qpQ4B227jGCCHKafb11v9pGZ N0YA== X-Gm-Message-State: AOAM530nwP8fCAtkzzh9zW1P1ppeuVCgJkdH0wDcKx3MRUVmR0dWvG7X hnJmmOL80+oNPkDWdCnPx/Rv2c0nFI0ws+LOCr6bUjmn7VNRZw== X-Google-Smtp-Source: ABdhPJyWXyCM+8TsFcjCi8BcllPAGy6s9CoIsDpuKb6flyOODK8kSy+L4kiLCr9/bzQDvrs8tYiWzOISXnPb46zjCBs= X-Received: by 2002:ac2:5970:: with SMTP id h16mr13270329lfp.605.1619463849843; Mon, 26 Apr 2021 12:04:09 -0700 (PDT) MIME-Version: 1.0 References: <20210426032200.GA26443@tarpaulin.shahaf.local2> In-Reply-To: <20210426032200.GA26443@tarpaulin.shahaf.local2> From: Marlon Richert Date: Mon, 26 Apr 2021 22:03:33 +0300 Message-ID: Subject: Re: [RFC][PATCH] Add zrestart() To: Daniel Shahaf Cc: Zsh hackers list Content-Type: text/plain; charset="UTF-8" X-Seq: 48718 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, Apr 26, 2021 at 6:22 AM Daniel Shahaf wrote: > > +{ > > + # Some users export $ZDOTDIR, which can mess things up. > > + local zdotdir=$ZDOTDIR > > + unset ZDOTDIR > > More importantly, I don't see any reason to munge $ZDOTDIR in the first > place. It amounts to second-guessing the user. It's a workaround for the following problem that I've observed in the wild: 1. $HOME/.zshenv does `export ZDOTDIR=foo` and . 2. $ZDOTDIR/.zshrc does something that relies on having happened. 3. User calls zrestart (or just `exec zsh`, for that matter). 4. The new shell now looks for foo/.zshenv instead of $HOME/.zshenv, but no such file exits. 5. .zshrc throws an error because hasn't happened in this shell. > > + 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". 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. 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 don't think that's an acceptable approach. What kind of approach would be acceptable?