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

mapfile and proc filesystem, limitation or possible bug



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=("${(f@)${mapfile[.zshrc]%$’\n’}}")
  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=("${(f@)${mapfile[status]%$’\n’}}")
  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


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