Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: ksharrays and assoc array assignments (was Re: Files modified after a given date)
- X-seq: zsh-users 2531
- From: Gabor <gabor@xxxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>, zsh-users@xxxxxxxxxxxxxx
- Subject: Re: PATCH: ksharrays and assoc array assignments (was Re: Files modified after a given date)
- Date: Sat, 28 Aug 1999 13:14:05 -0400
- In-reply-to: <990828050003.ZM30545@xxxxxxxxxxxxxxxxxxxxxxx>; from Bart Schaefer on Sat, Aug 28, 1999 at 05:00:03AM +0000
- Mailing-list: contact zsh-users-help@xxxxxxxxxxxxxx; run by ezmlm
- References: <199908230809.KAA02317@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> <19990827175122.A2818@xxxxxxxxxx> <990827224347.ZM28594@xxxxxxxxxxxxxxxxxxxxxxx> <19990827194419.A7511@xxxxxxxxxx> <990828050003.ZM30545@xxxxxxxxxxxxxxxxxxxxxxx>
Thanks. It works.
=== zsh-3.1.6 $ Src/zsh
=== zsh-3.1.6 $ stat -H foo .
=== zsh-3.1.6 $ print ${(kv)foo[@]}
blksize 8192 nlink 11 size 1024 rdev 211381 mode 16877 mtime 935722586
inode 47762 blocks 2 device 196614 atime 935860476 uid 1000 link ctime
935722586 gid 7
=== zsh-3.1.6 $
On Sat, Aug 28, 1999 at 05:00:03AM +0000, Bart Schaefer wrote:
# On Aug 27, 7:44pm, Gabor wrote:
# } Subject: Re: Files modified after a given date
# }
# } On Fri, Aug 27, 1999 at 10:43:47PM +0000, Bart Schaefer wrote:
# } # On Aug 27, 5:51pm, Gabor wrote:
# } # > Subject: Re: Files modified after a given date
# } # > === gabor $ builtin stat -H foo .zshrc
# } # > zsh: attempt to set slice of associative array
# } #
# } Well, I figured it out. I believe this to be a bug, though you
# } decide. I always set ksharrays since I like 0 based indexing and use
# } ksh for scripting at work. With ksharrays unset, it works.
#
# Aha. Yes, that's a bug. You can see it more easily with
#
# zsh% setopt ksharrays
# zsh% : ${(AA)=foo:=a b c d}
# zsh: attempt to set slice of associative array
#
# Here'a patch.
#
# Index: Src/params.c
# ===================================================================
# @@ -1697,9 +1697,14 @@
# v = NULL;
# }
# }
# - if (!v)
# - if (!(v = getvalue(&t, 1)))
# - return NULL;
# + if (!v) {
# + int k = opts[KSHARRAYS]; /* Remember the value of KSHARRAYS */
# + opts[KSHARRAYS] = 0; /* and clear it to avoid special- */
# + v = getvalue(&t, 1); /* case of $array --> ${array[0]}. */
# + opts[KSHARRAYS] = k; /* OK because we can't assign to a */
# + if (!v) /* slice of an association anyway, */
# + return NULL; /* so ANY subscript will be wrong. */
# + }
# setarrvalue(v, val);
# return v->pm;
# }
#
# --
# Bart Schaefer Brass Lantern Enterprises
# http://www.well.com/user/barts http://www.brasslantern.com
Messages sorted by:
Reverse Date,
Date,
Thread,
Author