Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] Restrict named directories to scalar parameters.



On Fri, Jun 12, 2026 at 12:41 PM Philippe Altherr
<philippe.altherr@xxxxxxxxx> wrote:
>
> - Restrict named directories to scalar parameters

Aside:  I suggest adding PS1="" to the input of zsh -fis for the Test/K01 patch.

I tried running the test for this without the accompanying patch to params.c.

--- expected
+++ actual
@@ -4,5 +4,5 @@
 nameddirs=( v1 /A )
 nameddirs=( v1 /A v2 /2 r2 /R )
 nameddirs=( v1 /A r2 /R )
-nameddirs=( v1 /A r2 /R )
-nameddirs=( v1 /A v2 /B r2 /R )
+nameddirs=( v1 /A )
+nameddirs=( v1 /A v2 /B )

Running the test standalone with -fvxis, the expected result diverges here:

   echo "nameddirs=( ${(kv)nameddirs} )"
+Src/zsh:13> echo 'nameddirs=( v1 /A r2 /R )'
nameddirs=( v1 /A r2 /R )
   r2=v2
+Src/zsh:14> r2=v2

That's initialized the placeholder nameref r2 with the name v2.  The
test asserts autonamedirs should not remove the previous forced entry
r2=/R from the named directory table, because r2 is not a plain
scalar?

If that's what you mean, then that's what the description of the patch
should be, because as far as I can tell all the other cases of "named
directory is not a scalar parameter" are handled by adduserdir().  If
you have a simple case of ~name or autonamedirs stuffing a non-scalar
into the table, please provide it.

I'm on the proverbial fence over whether the existing behavior
demonstrated by the test is in fact wrong.




Messages sorted by: Reverse Date, Date, Thread, Author