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

Re: mapfile and unset: Does this actually work?



FWIW this seems to be a regression introduced in your development branch. Using the 5.9 release, unset 'mapfile[removable]'  does indeed delete the file. I tested on macOS, Windows+msys2, and Ubuntu.


On Sat, Feb 3, 2024 at 11:25 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
If we're contemplating a release, does anyone else want to eyeball this?

On Sun, Jan 21, 2024 at 6:05 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> Doc says:
>
> mapfile
>      This associative array takes as keys the names of files; the
>      resulting value is the content of the file.  The value is treated
>      identically to any other text coming from a parameter.  The value
>      may also be assigned to, in which case the file in question is
>      written (whether or not it originally existed); or an element may
>      be unset, which will delete the file in question.
>
> However:
>
> % touch removable
> % zmodload zsh/mapfile
> % : $mapfile[removable] ; unset 'mapfile[removable]'
> % ls -l removable
> -rw-rw-r-- 1 schaefer schaefer 0 Jan 21 17:17 removable
>
> I tried several variations of this and I can't get mapfile to remove anything.

I still haven't worked out what's going on here.



--
Mark J. Reed <markjreed@xxxxxxxxx>


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