From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: from zero.zsh.org (zero.zsh.org [IPv6:2a02:898:31:0:48:4558:7a:7368]) by inbox.vuxu.org (Postfix) with ESMTP id 10AF5216BE for ; Fri, 26 Jan 2024 06:00:00 +0100 (CET) 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-Transfer-Encoding: Content-Type:Subject:Cc:To:From:Date:References:In-Reply-To:Message-Id: MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=zL5Xg271nBOb+2L0OrHTbj3NZ92hX/OsO6ilwimMGsE=; b=JDtN/aGKMeupiSjJf0v0J4JjP7 0JACy9nLHAhdtZJCwQkO3RjlopNDHKWpmEb0ZSKp1Kvpxh2s2P+37aQ2wthbwxvWR/1Q3RTNHK8yC AlDoR1POJj4H3w+lyn+yFXFzMw5XXIFJ0AnUqlP2RNScY/AQKgP0Ry8tjo0KyfucTJjUhAjtOY3uc /UTRa6wkBQgJ2jlJfIzBbpxylzSl8PmMcLTRp2JV8CHOWQBeJF1g7OXNOVnZZfN4POEDlfEZ7fjWG hnJxFXMGFaEDQcVxvOygoENAtSHwj6FVhI4iy6c6ghuDkulhfXPMK1aMEF9XsxFhFDHutxQYS9GTL m0zt2WAQ==; Received: by zero.zsh.org with local id 1rTEJs-000F5x-9H; Fri, 26 Jan 2024 05:00:00 +0000 Received: by zero.zsh.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1rTEJJ-000ENO-Ng; Fri, 26 Jan 2024 04:59:26 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailauth.nyi.internal (Postfix) with ESMTP id 3869827C005B; Thu, 25 Jan 2024 23:59:24 -0500 (EST) Received: from imap48 ([10.202.2.98]) by compute2.internal (MEProxy); Thu, 25 Jan 2024 23:59:24 -0500 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdeliedgjeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefofgggkfgjfhffhffvvefutgfgse htqhertderreejnecuhfhrohhmpefnrgifrhgvnhgtvgcugggvlhojiihquhgviicuoehl rghrrhihvhesiihshhdrohhrgheqnecuggftrfgrthhtvghrnhepheegieduieegvddvff dvgeefuddugfetvdettddtfedutdejvefgjefgveethedunecuvehluhhsthgvrhfuihii vgeptdenucfrrghrrghmpehmrghilhhfrhhomheplhgrrhhrhihvodhmvghsmhhtphgruh hthhhpvghrshhonhgrlhhithihqdduudehudekjeejtdegqdduudelvdejfeekhedqlhgr rhhrhihvpeepiihshhdrohhrghesfhgrshhtmhgrihhlrdgtohhm X-ME-Proxy: Feedback-ID: iaa214773:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id EBC9931A0065; Thu, 25 Jan 2024 23:59:23 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.11.0-alpha0-119-ga8b98d1bd8-fm-20240108.001-ga8b98d1b MIME-Version: 1.0 Message-Id: In-Reply-To: <3DC872AC-5B19-468D-85D5-5D3A501EF7E9@dondley.com> References: <73E4333B-C282-4A58-837C-A50F73E13289@dondley.com> <680FA5D3-E8FD-49F2-9AE3-C169A6D9DA9E@dondley.com> <4a1df20e-70c4-41ed-b370-4fbbae0619b9@app.fastmail.com> <3DC872AC-5B19-468D-85D5-5D3A501EF7E9@dondley.com> Date: Thu, 25 Jan 2024 23:58:42 -0500 From: =?UTF-8?Q?Lawrence_Vel=C3=A1zquez?= To: "Steve Dondley" Cc: zsh-users@zsh.org Subject: Re: Can't tell the difference in operation between PATH_SCRIPT and NO_PATH_SCRIPT Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Seq: 29571 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: On Thu, Jan 25, 2024, at 11:17 PM, Steve Dondley wrote: > I guess I never realized that, when it comes to options, there is a=20 > difference between running a script directly and passing it as an=20 > argument to zsh.=20 You're overgeneralizing. PATH_SCRIPT is defined to only affect the latter scenario, but you are confused because you have been trying to apply it to the former scenario. There is no broader lesson about options here. It's like being confused that POSIX_CD doesn't make the jobs(1) builtin more POSIX-conformant, even though it never claimed to. It is a category mistake. > But even still, If I do this: > >> echo $PATH > /usr/bin:./dir > >> ls dir > -rwxr--r-- 1 root root 9 Jan 26 03:26 foo.zsh > >> setopt pathscript > >> zsh foo.zsh > zsh: can't open input file: foo.zsh > >> unsetopt pathscript > >> zsh foo.zsh > zsh: can't open input file: foo.zsh > > > So I=E2=80=99m still seeing no difference between execution of the scr= ipt with=20 > path script on or off in these cases. Options are not inherited by child shells created in this manner. That is why my demonstration used -o and +o. % ([[ -o EXTENDED_GLOB ]]; print $?) 1 % setopt EXTENDED_GLOB % ([[ -o EXTENDED_GLOB ]]; print $?) 0 % zsh -c '[[ -o EXTENDED_GLOB ]]; print $?' 1 > HOWEVER, I discovered if I put this in my .zshrc: > > setopt pathscript > > and do: > >> zsh -i foo.zsh > > It works. Yes, because interactive shells source .zshrc. > Or, if I do > >> setopt pathscript > > and then do > >> zsh -c foo.zsh > > This also works. No, you are conflating unrelated things again. With -c, zsh evaluates the "foo.zsh" argument as a complete script, so it performs a PATH search as usual. As I said earlier, PATH_SCRIPT *does not apply* to ''zsh -c''; its status is irrelevant. % cat foo.sh cat: foo.sh: No such file or directory % cat dir/foo.sh echo foo % PATH=3D./dir /bin/zsh -o PATH_SCRIPT -c foo.sh=20 foo % PATH=3D./dir /bin/zsh +o PATH_SCRIPT -c foo.sh foo --=20 vq