Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: unbounded recursive call in a shell script crashes zsh
- X-seq: zsh-workers 40980
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: unbounded recursive call in a shell script crashes zsh
- Date: Sun, 16 Apr 2017 18:56:28 +0000
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= fm1; bh=+Y1JgG/fqXgZ6pPMWb5S7Ic5OB3Qb6/CX/L6fkVVa5Y=; b=eM3OdB6p m18/OdKtP3okxxpFgNu7r/W8IJdDLHdiLTKbTwZozBqHFHi/9rGTV94tYcuCM57a BocMiF+xgJqYWLbu+t5m33WMaxKORqmbj0aM2ej89QiMX0BdM+a9s7fso0YHdbY+ ISt4zLVzkNICZphb+SqWDBOgJxFpbmDulC9ETSEl7uhZzz/0QX21qQepag4kY17X I/zC8QxczYHqiM0g97WLP/tgcgO/u5RQTQrLyZhtXvJzASVoGbSugRXqEAw68llq UQ9QenhoMtC1GgZ85E199C5M7AU5KaND7UGi2BoZnIvvAi97ke/Poc/nDUvZIiwd R1fHXgm/kXX4fA==
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= fm1; bh=+Y1JgG/fqXgZ6pPMWb5S7Ic5OB3Qb6/CX/L6fkVVa5Y=; b=l9c8bb2R UHA1kcsSmQx5g0ihsHAX2K7uls5DP5oRMetw4QPTsrL9GeemJt3UfuQ+9RvPviSz iCswSLXsHlelm5n9OuoZZyu0buNDsLl6+MMdUNQ/L1Xu6zCXpC0GRV/zdzkL22lE leNlbUz/HZNtrZIJ0gmokdbW7Wobdm/fYpN4Y12goUMJyY/KNMBVFPQ5GcS2oOJu ZWS1a23/IVrEBLO+Uv4Uw+hKlFLLmjqMP2xfKVcJpHLnuRejUBWZPedHgpnQfNrC fd1rAHFSwXryXKmddWHkFOS4QF8dHUZ8eeu0hbKfVWsJOW+iZOgHYJLS6I625bef Dwb0wTFcglHjHQ==
- In-reply-to: <170415091456.ZM22606@torch.brasslantern.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <2960832.nVDpiBkaWZ@kdudka-nb> <2420758.31stuSQeAV@kdudka-nb> <CAH+w=7atHK+_7fdzxCB4gRkWiKW8zCcTvW-qHM-0fUjH=OsPDQ@mail.gmail.com> <2350280.olGvC23INb@kdudka-nb> <CAFOazAO2jcj+zPpJuHXtykUE4yGR0FnYA5+-xHgH4nu_gDZgbw@mail.gmail.com> <CAFOazAM8N5ZQEv_HtQwt-18M6aNOTEMhGAmYxO0De1cjpjnjXA@mail.gmail.com> <170415091456.ZM22606@torch.brasslantern.com>
Bart Schaefer wrote on Sat, Apr 15, 2017 at 09:14:56 -0700:
> If not for the variable thrown in by the compiler options it might be
> possible for zsh to estimate a value for max function depth at the
> time it starts up, by examining the current limits,
>
Hmm. Would it work to measure the stack space used, by declaring
a local variable in main(), stashing its address in a global write-once
variable, and then subtracting the address of a function-local variable
from the global? That is:
extern const void *top_of_stack;
main() {
const int x = …;
top_of_stack = &x;
⋮
}
foo() {
int x;
printf("Stack space in use: %llu\n", (unsigned long long)(top_of_stack - &x));
}
(I somewhat expect this to be a bad idea...)
> but there's also no guarantee that the limit settings reflect the
> actual amount of stack available.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author