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

Re: ZSH crashed when reading bytes from a large binary



> On 15/09/2022 11:19 Jun T <takimoto-j@xxxxxxxxxxxxxxxxx> wrote:
> Consider a script something like:
> 
> if read x < $file; then
>     # do something
> else
>     rm $file     # it's empty and we can remove it
> fi
> 
> Yes, this script is wrong since read returns 1 even if $file is not empty
> (if there is no \n). But I fear there may be some (only a few?) users
> using scripts like this.

There is an argument that we might be able to put in enough checking without
a rewrite to catch some particularly nasty cases --- and reading something
not under your control certainly seems to qualify as one of those.

It's still tough to catch all the levels necessary for this, though, and
it's a marginal additional benefit rather than a fix.  But I'd admire
anyone with the determination to have a go.

pws




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