From: Jun T <takimoto-j@kba.biglobe.ne.jp>
To: zsh-workers@zsh.org
Subject: Re: ZSH crashed when reading bytes from a large binary
Date: Thu, 15 Sep 2022 19:19:02 +0900 [thread overview]
Message-ID: <1A4B61B5-447F-45EC-BF07-7B1041814BC6@kba.biglobe.ne.jp> (raw)
In-Reply-To: <CAH+w=7ZgOzi1uPrCC8gzoGH86K3+z1-O-+1WtfnxFPjwdhNd6A@mail.gmail.com>
> 2022/09/15 6:43, Bart Schaefer <schaefer@brasslantern.com> wrote:
>
> On Mon, Sep 12, 2022 at 12:37 AM Jun T <takimoto-j@kba.biglobe.ne.jp> wrote:
>>
>> Can we simply replace them by zrealloc()?
>
> Replacing them with zrealloc() will still result in immediate exit of
> the shell, just with a different error message and no stack trace.
On Linux zsh coredumps without any error message if realloc() is used.
But getting core would make debug easier...
> The specific question here is whether having the "read" builtin return
> failure at this point will allow the shell to recover from the
> out-of-memory state, or whether it's just delaying the inevitable
> death.
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.
next prev parent reply other threads:[~2022-09-15 10:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-11 14:43 Liu, Song
2022-09-12 7:36 ` Jun T
2022-09-14 21:43 ` Bart Schaefer
2022-09-15 10:19 ` Jun T [this message]
2022-09-15 10:41 ` Peter Stephenson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1A4B61B5-447F-45EC-BF07-7B1041814BC6@kba.biglobe.ne.jp \
--to=takimoto-j@kba.biglobe.ne.jp \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).