From: Vincent Lefevre <vincent@vinc17.net>
To: zsh-workers@zsh.org
Subject: Re: segmentation fault with {1..1234567}
Date: Sat, 5 Jul 2014 13:12:33 +0200 [thread overview]
Message-ID: <20140705111233.GA19385@xvii.vinc17.org> (raw)
In-Reply-To: <140704184036.ZM18558@torch.brasslantern.com>
On 2014-07-04 18:40:36 -0700, Bart Schaefer wrote:
> On Jul 4, 7:25pm, Vincent Lefevre wrote:
> }
> } With zsh 5.0.5 (Debian/unstable):
> }
> } $ zsh -c 'echo {1..1234567}'
> } zsh: segmentation fault (core dumped) zsh -c 'echo {1..1234567}'
> }
> } If a failure is expected for any reason, it shouldn't be a crash.
>
> Whether that expression fails depends entirely on the memory allocation
> limitations of the local host. It works fine for me.
That's not a memory allocation problem: it fails on a machine
with 24GB!
> What's the "expected" behavior of the shell when the user requests a
> vast amount of memory? How should the shell recover from running out of
> memory at any arbitrary point during execution of a command or script?
> Is it really helpful to trap the signal and exit *without* dumping core?
No, the signal means that it is already too late. You should really
check the return code of malloc and so on. If this comes from a
command like here, the best thing is to make it fail, e.g. in an
interactive shell:
$ some_command
zsh: out of memory
$
with $? being non-zero, and possibly with some details in the message.
--
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
next prev parent reply other threads:[~2014-07-05 11:12 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-04 17:25 Vincent Lefevre
2014-07-05 1:40 ` Bart Schaefer
2014-07-05 11:12 ` Vincent Lefevre [this message]
2014-07-05 16:57 ` Bart Schaefer
2014-07-05 23:39 ` Vincent Lefevre
2014-07-06 0:09 ` Vincent Lefevre
2014-07-06 19:46 ` Bart Schaefer
2014-07-07 1:12 ` Vincent Lefevre
2014-07-06 16:16 ` Bart Schaefer
2014-07-06 18:30 ` Peter Stephenson
2014-07-06 19:46 ` Bart Schaefer
2014-07-06 22:23 ` Mikael Magnusson
2014-07-07 19:33 ` Peter Stephenson
2014-07-08 1:08 ` Bart Schaefer
2014-07-08 10:38 ` Peter Stephenson
2014-07-24 9:44 ` Peter Stephenson
2014-07-24 15:35 ` Bart Schaefer
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=20140705111233.GA19385@xvii.vinc17.org \
--to=vincent@vinc17.net \
--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).