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.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE, 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 18693240A5 for ; Fri, 26 Jan 2024 06:21:16 +0100 (CET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1706246476; b=hxmKbIEqLfc8IdS3tpxiECCyRz5yFTFTo+sM+7M/qinA0Uiwmr4Q3hT3X6vukGB/Otx6gOtDpV vzRKuzMwT6GNi6VZJASkmm4r8dmWJgIdo7mUP4dRQa0blSbrtYsIxb19CARGCvIIX5I4l3ekhd 1lyMIxMbTTjinCB9aJ3i8pMX5JJzCCiDsciUQgR2I/JE47T3fyKrUgCyZK4rYT8AWqZjqZp+dv Njmj+NuYTxngF+LkoWoihIfVwIGNEVkQawGlm2JqvPRvEBEY74NPX/4Xy9pqVZVDCyPYioYf6O LMl5msXzSZDxfiedtwT8dDmxbB0FP2hqN0OKRXKsZ1Shlw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (email.dondley.com) smtp.remote-ip=34.203.132.18; dkim=pass header.d=dondley.com header.s=default header.a=rsa-sha256; dmarc=pass header.from=dondley.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1706246476; bh=EW4u/Muot2cEOUCDQbNAOIpSJ9uvsjTz34lRHZzbD0Q=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:References:To:Cc:In-Reply-To:Date:Subject:MIME-Version: Content-Type:Message-ID:From:DKIM-Signature:DKIM-Signature; b=FP6U4WrWWZ8O+RVnVrBen9xWvQEq3afC7LJ+UclVh3rIESn6enSLYwElFR+bm1pvRmwM5kk9P6 wSU/p7vjqANymltnIbdykuLLNBwnVWXWaMiEAFZdW8XySRmGeSgOMvGrxdHFVe6Vtf4+yG3nSs JpIoWCWf0rtHycCVaZAPWVttr8198Be8T6jDYI5W7SGplcQxuwJhun3rHp2EeDOlG49RiY4kLM 0OVdlWB3oE55ozFFTq5/KbztWE2fEklXKJJT4Udc1axMh1jFPwD9Zy9+NqWrYEcv/8vN/D4IIs MEO3mnvg/BDJhLT3KF54VwCXraPzaocVsaTG9gcL4tTspw==; 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:References:To:Cc:In-Reply-To:Date: Subject:Mime-Version:Content-Type:Message-Id:From:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=izl48F/cmHZjnHj/opNCoQPMnXKA+0KERyifSX8usyg=; b=STuxz3dt+PCZYcAzJkvzvOcY5W d2RQPP6IrP+n3msTpII63YKC6gYb8bTYp/HrkONunZbbgtWXTUmtdcHoAlq7zmzFaanN9ie/5s6V3 sM4zbxXdauiQDX+ed6iM5Enj5F37alZWya2LHCOWeCBcXfAR/cd1aGPbCi8tGZ6VnHYlCR4ReYzu7 D2qQ5CodudO5nFuz4cH+fMy3n9JrOzXSzFd/ZpsGZndFh35N8WFcKq4AqAveGiY7WgO8dJDoHFA7Q VjSt4euie1XEA3xYqm6NclM9hvk6DSuN9z6+0AWyoNLZa9Hne+SO+rwjK3MeyU3mlJ4Ti6A1bpJxS RD0sbzvw==; Received: by zero.zsh.org with local id 1rTEeR-000H1B-QG; Fri, 26 Jan 2024 05:21:15 +0000 Authentication-Results: zsh.org; iprev=pass (email.dondley.com) smtp.remote-ip=34.203.132.18; dkim=pass header.d=dondley.com header.s=default header.a=rsa-sha256; dmarc=pass header.from=dondley.com; arc=none Received: from email.dondley.com ([34.203.132.18]:35348) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1rTEdV-000GKj-CN; Fri, 26 Jan 2024 05:20:18 +0000 Received: from smtpclient.apple (unknown [216.193.141.189]) by email.dondley.com (Postfix) with ESMTPSA id A4BB620189; Fri, 26 Jan 2024 00:20:14 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=dondley.com; s=default; t=1706246414; bh=EW4u/Muot2cEOUCDQbNAOIpSJ9uvsjTz34lRHZzbD0Q=; h=From:Subject:Date:In-Reply-To:Cc:To:References:From; b=guDrDB3UMcaPErPJ57QfCFMqYbOjlR35W3kwphBpE1pY5+8UD9ka/PhEGliPb6bp0 9I8+Tfgsjn51J33SoznkYmvXzGP2YOXoEkFNbB7DdTtT6V2Hvt01jd/hBZbKUcl7Nd DT2Yi8R3F+8IG/0EVvGlQleD5torAqj1Afb9v5Uv9h+m3jb7QGjCTzmjmAAS+DX+qz jppY7B6cF6MqcJd+NVk20dXAzpCaHfZFjHAKLkm3Yp27SqvPoEBPkazlf0hRQnEOXH 2aUEGvGt+soavIvb4qO0St253XjWZGfU6I+pjDRhRsKp6yelGLmi5dctgkNH4OwvwI BXyRs+KVUWN+A== From: Steve Dondley Message-Id: <2CF29A22-6721-4275-8E92-7FF61CE4CDCB@dondley.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_EE256766-A47F-4EDA-A7FA-C0D93A0D6EE1" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.400.31\)) Subject: Re: Can't tell the difference in operation between PATH_SCRIPT and NO_PATH_SCRIPT Date: Fri, 26 Jan 2024 00:20:03 -0500 In-Reply-To: Cc: zsh-users@zsh.org To: =?utf-8?Q?Lawrence_Vel=C3=A1zquez?= 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> X-Mailer: Apple Mail (2.3774.400.31) X-Seq: 29572 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: --Apple-Mail=_EE256766-A47F-4EDA-A7FA-C0D93A0D6EE1 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 OK, thanks. At the risk of dragging this on, allow me to ask this simple question to = make sure I got it: Is there any way to run this command by itself on the command line: > setopt pathscript And have it affect the outcome of any subsequent commands? It looks like = the answer is no.=20 It looks to me like the pathscript setting can only affect future = commands if it=E2=80=99s either: a) used with +o or -o as part of an argument passed directly to zsh = while running a script b) or if it=E2=80=99s set in a .zshrc file (or other config file) and = then sourced when a new shell (interactive mode) Please tell me I have this correct otherwise I=E2=80=99m still badly = confused.=20 > On Jan 25, 2024, at 11:58=E2=80=AFPM, Lawrence Vel=C3=A1zquez = wrote: >=20 > 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 >=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. >=20 > 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. >=20 >=20 >> But even still, If I do this: >>=20 >>> echo $PATH >> /usr/bin:./dir >>=20 >>> ls dir >> -rwxr--r-- 1 root root 9 Jan 26 03:26 foo.zsh >>=20 >>> setopt pathscript >>=20 >>> zsh foo.zsh >> zsh: can't open input file: foo.zsh >>=20 >>> unsetopt pathscript >>=20 >>> zsh foo.zsh >> zsh: can't open input file: foo.zsh >>=20 >>=20 >> So I=E2=80=99m still seeing no difference between execution of the = script with=20 >> path script on or off in these cases. >=20 > Options are not inherited by child shells created in this manner. > That is why my demonstration used -o and +o. >=20 > % ([[ -o EXTENDED_GLOB ]]; print $?) > 1 > % setopt EXTENDED_GLOB > % ([[ -o EXTENDED_GLOB ]]; print $?) > 0 > % zsh -c '[[ -o EXTENDED_GLOB ]]; print $?' > 1 >=20 >=20 >> HOWEVER, I discovered if I put this in my .zshrc: >>=20 >> setopt pathscript >>=20 >> and do: >>=20 >>> zsh -i foo.zsh >>=20 >> It works. >=20 > Yes, because interactive shells source .zshrc. >=20 >=20 >> Or, if I do >>=20 >>> setopt pathscript >>=20 >> and then do >>=20 >>> zsh -c foo.zsh >>=20 >> This also works. >=20 > 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. >=20 > % 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 >=20 > --=20 > vq --Apple-Mail=_EE256766-A47F-4EDA-A7FA-C0D93A0D6EE1 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 OK, = thanks.

At the risk of dragging this on, allow me to = ask this simple question to make sure I got it:

Is = there any way to run this command by itself on the command = line:

> setopt pathscript

And have it affect the outcome of any subsequent commands? It = looks like the answer is no. 

It looks to = me like the pathscript setting can only affect future commands if it=E2=80= =99s either:

a) used with +o or -o as part of = an argument passed directly to zsh while running a script
b) = or if it=E2=80=99s set in a .zshrc file (or other config file) and then = sourced when a new shell (interactive = mode)

Please tell me I have this correct = otherwise I=E2=80=99m still badly = confused. 




On Jan 25, 2024, at 11:58=E2=80=AF= PM, Lawrence Vel=C3=A1zquez <larryv@zsh.org> wrote:

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 
difference between = running a script directly and passing it as an 
argument to zsh. 

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 script with 
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 
foo
% PATH=3D./dir /bin/zsh = +o PATH_SCRIPT -c foo.sh
= foo


-- 
vq

= --Apple-Mail=_EE256766-A47F-4EDA-A7FA-C0D93A0D6EE1--