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

Re: Bug#112424: zsh: zsh can't read from /proc



Do we want to special-case this?

> zsh seems to have trouble reading from /proc special files.
> For example:
> 
> bzzrt:/home/wsl% read HOST </proc/sys/kernel/hostname
> 1 b:/home/wsl% cat /proc/sys/kernel/hostname | read HOST
> bzzrt:/home/wsl%
> 
> After the first command, $HOST is set to "b" and the return code of
> the command is 1 (my prompt is configured to show this). When using
> cat everything is fine, and $HOST is once again set to the proper
> host name ("bzzrt").
> 
> The problem is that zsh reads files one byte at a time. This is
> perfectly legitimate of course, but Linux does not seem to support
> that for /proc files. An acceptable workaround for Linux' poor
> performance would be to fstat(stdin) and use a large read if stat
> reports a zero file size (and the file is a plain file).
> 
> Of course, the real location to fix this would be the Linux kernel.



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