mapfile and proc filesystem, limitation or possible bug
Jim <[email protected]> Mon, 22 Jun 2026 17:51:08 -0500
| Newsgroups | gmane.comp.shells.zsh.user |
|---|---|
| Message-ID | <CA+rB6GK3uNBh42y5b_XzocQ=CZBTbmXPDYT50iisytS7Q+mTMw@mail.gmail.com> |
--0000000000000fe4d20654df7be4
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Hello,
ZSH_VERSION: 5.9.1
Is there a limitation with mapfile when it comes to the proc filesystem or
is there a bug?
In a normal directory like $HOME the following work as expected:
% cd $HOME
% print ${(ok)mapfile)
outputs all names
% [[ -v mapfile[.zshrc] ]] && print Found || print Not Found
outputs: Found
% array=3D("${(f@)${mapfile[.zshrc]%$=E2=80=99\n=E2=80=99}}")
array is populated
In a proc directory it does not
% cd /proc/$$
% print ${(ok)mapfile)
outputs all names as expected
% [[ -v mapfile[status] ]] && print Found || print Not Found
outputs: Not Found
% array=3D("${(f@)${mapfile[status]%$=E2=80=99\n=E2=80=99}}")
array contains one empty element
The man page lists a number of mapfile LIMITATIONS, but I didn't see
anything that I
interpreted as the proc filesystem. If it is a limitation should something
more clear be
added to the manpage?
There are other ways of checking files and getting data from the proc
files, but I was
hoping to determine why mapfile doesn't work.
% print ${(t)mapfile} -> association-hide-hideval-special
% print ${(t)commands} -> association-hide-hideval-special
The above both have the same keywords defining them, and still outputs as
expected.
% [[ -v commands[nvim] ]] && print Found || print Not Found
outputs Found
The only difference I can tell, from my previous examples with mapfile, is
different
filesystem types.
Any clarification would be appreciated.
Regards,
Jim Murphy
--0000000000000fe4d20654df7be4
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><div di=
r=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr">Hello,</div><d=
iv dir=3D"ltr"><br></div><div dir=3D"ltr">ZSH_VERSION:=C2=A0 5.9.1<br><div>=
<br></div><div>Is there a limitation with mapfile when it comes to the proc=
filesystem o<span style=3D"background-color:transparent">r is there a bug?=
</span></div><div><span style=3D"background-color:transparent">In a normal =
directory like $HOME the following work as expected:</span></div><div><span=
style=3D"background-color:transparent"><br></span></div><div>%=C2=A0 cd $H=
OME</div><div>%=C2=A0 print ${(ok)mapfile)</div><div>=C2=A0 outputs all nam=
es</div><div><span style=3D"background-color:transparent">%=C2=A0 [[ -v map=
file[.zshrc] ]] && print Found || print Not Found</span></div><div>=
<span style=3D"background-color:transparent">=C2=A0 outputs:=C2=A0 Found</s=
pan></div><div><span style=3D"background-color:transparent">%=C2=A0 ar</spa=
n><span style=3D"background-color:transparent">ray=3D("${(f@)${mapfile=
[.zshrc]%$=E2=80=99\n=E2=80=99}}")</span></div><div><span style=3D"bac=
kground-color:transparent">=C2=A0 array is populated</span></div><div><span=
style=3D"background-color:transparent"><br></span></div><div><span style=
=3D"background-color:transparent">In a proc directory it does not</span></d=
iv><div><span style=3D"background-color:transparent"><br></span></div><div>=
%=C2=A0 cd /proc/$$</div><div>%=C2=A0 print ${(ok)mapfile)<br>=C2=A0 output=
s all names as expected<br>%=C2=A0 [[ -v mapfile[status] ]] && prin=
t Found || print Not Found</div><div>=C2=A0 outputs:=C2=A0 Not Found<br>%=
=C2=A0 array=3D("${(f@)${mapfile[status]%$=E2=80=99\n=E2=80=99}}"=
)<span style=3D"background-color:transparent"></span></div><div>=C2=A0 arra=
y contains one empty element</div><div><br></div><div>The man page lists a =
number of mapfile LIMITATIONS, but I didn't see anything that I</div><d=
iv>interpreted as the proc filesystem. If it is a limitation should somethi=
ng more clear be</div><div>added to the manpage?</div><div><br></div><div>T=
here are other ways of checking files and getting data from the proc files,=
but I was</div><div>hoping to determine why mapfile doesn't work.</div=
><div><br></div><div>% print ${(t)mapfile}=C2=A0 ->=C2=A0<span style=3D"=
background-color:transparent">association-hide-hideval-special</span></div>=
<div>% print ${(t)commands} ->=C2=A0association-hide-hideval-special</di=
v><div><br></div><div>The above both have the=C2=A0same keywords defining t=
hem, and still=C2=A0outputs as expected.</div><div>%=C2=A0[[ -v commands[nv=
im] ]] && print Found || print Not Found</div><div>=C2=A0 outputs F=
ound</div><div><br></div><div>The only difference I can tell, from my previ=
ous examples with mapfile, is different</div><div>filesystem types.</div><d=
iv><br></div><div>Any clarification=C2=A0would be appreciated.</div><div><b=
r></div><div>Regards,</div><div><br></div><div>Jim Murphy</div></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
--0000000000000fe4d20654df7be4--