zsh-users
 help / color / mirror / code / Atom feed
* Why is path not a -aUT type?
@ 2022-05-31 11:16 Zach Riggle
  2022-05-31 12:30 ` Andreas Kusalananda Kähäri
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Zach Riggle @ 2022-05-31 11:16 UTC (permalink / raw)
  To: Zsh Users

[-- Attachment #1: Type: text/plain, Size: 217 bytes --]

It seems to me that having duplicate entries in $PATH / $path is a bit
silly, and makes some things hard to do.

Is there any reason that, by default, we do not

typeset -aUT PATH path


Automatically?

*Zach Riggle*

[-- Attachment #2: Type: text/html, Size: 559 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Why is path not a -aUT type?
  2022-05-31 11:16 Why is path not a -aUT type? Zach Riggle
@ 2022-05-31 12:30 ` Andreas Kusalananda Kähäri
  2022-05-31 17:22 ` Bart Schaefer
  2023-04-01  0:01 ` Daniel Shahaf
  2 siblings, 0 replies; 7+ messages in thread
From: Andreas Kusalananda Kähäri @ 2022-05-31 12:30 UTC (permalink / raw)
  To: Zach Riggle; +Cc: Zsh Users

On Tue, May 31, 2022 at 06:16:17AM -0500, Zach Riggle wrote:
> It seems to me that having duplicate entries in $PATH / $path is a bit
> silly, and makes some things hard to do.
> 
> Is there any reason that, by default, we do not
> 
> typeset -aUT PATH path
> 
> 
> Automatically?
> 
> *Zach Riggle*

PATH is no array, so "typeset -a" feels wrong.
PATH and path are already tied by default, no?

As for "typeset -U", that's useful to have, but I can definitely see
that one may want to e.g. temporarily add a directory path at the start
of PATH/path and then remove it again without disturbing the old values
of the variables.

-- 
Andreas (Kusalananda) Kähäri
SciLifeLab, NBIS, ICM
Uppsala University, Sweden

.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Why is path not a -aUT type?
  2022-05-31 11:16 Why is path not a -aUT type? Zach Riggle
  2022-05-31 12:30 ` Andreas Kusalananda Kähäri
@ 2022-05-31 17:22 ` Bart Schaefer
  2022-05-31 17:44   ` Lawrence Velázquez
  2023-04-01  0:01 ` Daniel Shahaf
  2 siblings, 1 reply; 7+ messages in thread
From: Bart Schaefer @ 2022-05-31 17:22 UTC (permalink / raw)
  To: Zach Riggle; +Cc: Zsh Users

On Tue, May 31, 2022 at 4:16 AM Zach Riggle <zachriggle@gmail.com> wrote:
>
> Is there any reason that, by default, we do not
>
> typeset -aUT PATH path

The main one is that PATH is imported from the environment and it's
messy to immediately mung it and push it back there before we've even
finished the rest of pre-RC-file shell initialization.  Further, it's
not up to us to decide how that value should be passed through to
child processes when zsh is used as a launcher by/for some other
application.

Not directly relevant to your intent, but "typeset -T XX xx" implies
that xx is an array, the -a option is not needed (and as Andreas
points out, wrong for XX).


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Why is path not a -aUT type?
  2022-05-31 17:22 ` Bart Schaefer
@ 2022-05-31 17:44   ` Lawrence Velázquez
  0 siblings, 0 replies; 7+ messages in thread
From: Lawrence Velázquez @ 2022-05-31 17:44 UTC (permalink / raw)
  To: Bart Schaefer, Zach Riggle; +Cc: zsh-users

On Tue, May 31, 2022, at 1:22 PM, Bart Schaefer wrote:
> On Tue, May 31, 2022 at 4:16 AM Zach Riggle <zachriggle@gmail.com> wrote:
>>
>> Is there any reason that, by default, we do not
>>
>> typeset -aUT PATH path
>
> The main one is that PATH is imported from the environment and it's
> messy to immediately mung it and push it back there before we've even
> finished the rest of pre-RC-file shell initialization.  Further, it's
> not up to us to decide how that value should be passed through to
> child processes when zsh is used as a launcher by/for some other
> application.

It's also presumptuous to assume that all users want this.
I actually stopped deduplicating PATH/path recently because I want
to know when some application or other is trying to modify it behind
my back without having zsh possibly deduplicate the evidence away.

-- 
vq


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Why is path not a -aUT type?
  2022-05-31 11:16 Why is path not a -aUT type? Zach Riggle
  2022-05-31 12:30 ` Andreas Kusalananda Kähäri
  2022-05-31 17:22 ` Bart Schaefer
@ 2023-04-01  0:01 ` Daniel Shahaf
  2023-04-02  7:56   ` Daniel Shahaf
  2 siblings, 1 reply; 7+ messages in thread
From: Daniel Shahaf @ 2023-04-01  0:01 UTC (permalink / raw)
  To: Zsh Users

Zach Riggle wrote on Tue, 61 Apr 2022 11:16 +00:00:
> It seems to me that having duplicate entries in $PATH / $path is a bit
> silly, and makes some things hard to do.
> 
> Is there any reason that, by default, we do not
> 
> typeset -aUT PATH path
> 
> 
> Automatically?

Yes.  $path is non-unique by default for interoperability with the OS
zsh was created on.

That OS sports a stat(2)-based port\ knocking-like facility for hiding
specific inodes from all but select users.  In a nutshell, on that OS
stat("/secretfile") or open("/secretfile") succeed only if the user has
just stat()ed particular paths in a particular order.  Thus, on that OS and
with an appropriate secret knock configured in the shadow(5) file in effect,
«PATH=/foo:/bar:/bar:/bin» behaves differently to «PATH=/foo:/bar:/bin»
(see hashcmd() and hashdir() in the zsh sources).

Similar facilities for secret handshakes are documented in SSL_do_handshake(3),
gnutls_handshake(3), et al., provided one has opened the right sequence of
other man pages first.

Cheers,

Daniel


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Why is path not a -aUT type?
  2023-04-01  0:01 ` Daniel Shahaf
@ 2023-04-02  7:56   ` Daniel Shahaf
  2023-04-02 16:00     ` Ray Andrews
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Shahaf @ 2023-04-02  7:56 UTC (permalink / raw)
  To: Zsh Users

Daniel Shahaf wrote on Sat, 01 Apr 2023 00:01 +00:00:
> Zach Riggle wrote on Tue, 61 Apr 2022 11:16 +00:00:
>> It seems to me that having duplicate entries in $PATH / $path is a bit
>> silly, and makes some things hard to do.
>> 
>> Is there any reason that, by default, we do not
>> 
>> typeset -aUT PATH path
>> 
>> 
>> Automatically?
>
> Yes.  $path is non-unique by default for interoperability with the OS
> zsh was created on.

To be clear, that was an April Fools' Day prank.  See the rest of this thread
for serious answers.

Thanks to Matthew for reviewing a draft.  (He was the first to respond to my
IRC request for reviewers.)

Daniel

P.S.  If you wonder how I had time for /this/ of all things, the answer
      is, I didn't.  I did most of the drafting and reviewing months
      ago, and sent this via at(1).


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Why is path not a -aUT type?
  2023-04-02  7:56   ` Daniel Shahaf
@ 2023-04-02 16:00     ` Ray Andrews
  0 siblings, 0 replies; 7+ messages in thread
From: Ray Andrews @ 2023-04-02 16:00 UTC (permalink / raw)
  To: zsh-users


On 2023-04-02 00:56, Daniel Shahaf wrote:
>
>> Yes.  $path is non-unique by default for interoperability with the OS
>> zsh was created on.
> To be clear, that was an April Fools' Day prank.  See the rest of this thread
> for serious answers.

Thanks for coming clean, I bought it hook, line and sinker.  I was even 
going to post a 'thanks' because I love those historical anecdotes, they 
often give insight into the cultural foundations of various things that 
are otherwise hard to understand.  And it would have been so completely 
believable if that story had been true.  There are, after all, backdoors 
into half the softwares out there, no?  I like to say that zsh is like 
the London street map -- not always exactly logical but there are 
quaint, historical reasons for it and if you know the history it's 
easier to make peace with the fact that you are entirely lost.





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-04-02 16:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-31 11:16 Why is path not a -aUT type? Zach Riggle
2022-05-31 12:30 ` Andreas Kusalananda Kähäri
2022-05-31 17:22 ` Bart Schaefer
2022-05-31 17:44   ` Lawrence Velázquez
2023-04-01  0:01 ` Daniel Shahaf
2023-04-02  7:56   ` Daniel Shahaf
2023-04-02 16:00     ` Ray Andrews

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).