Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #14402
| Path | csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail |
|---|---|
| From | Grisha Levit <grishalevit@gmail.com> |
| Newsgroups | gnu.bash.bug |
| Subject | Re: segfault w/ localvar_inherit and associative array insert |
| Date | Thu, 26 Jul 2018 15:15:31 -0400 |
| Lines | 55 |
| Approved | bug-bash@gnu.org |
| Message-ID | <mailman.4276.1532632548.1292.bug-bash@gnu.org> (permalink) |
| References | <CAMu=BroMwXaqDTT3qusycRGRdXevmxiwC0RpR8+wGooo83pWgg@mail.gmail.com> <2e51ae31-5fb0-633b-6d7b-faab8df39585@case.edu> |
| NNTP-Posting-Host | lists.gnu.org |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="UTF-8" |
| X-Trace | usenet.stanford.edu 1532632548 30561 208.118.235.17 (26 Jul 2018 19:15:48 GMT) |
| X-Complaints-To | action@cs.stanford.edu |
| Cc | bug-bash <bug-bash@gnu.org> |
| To | Chester Ramey <chet.ramey@case.edu> |
| Envelope-to | bug-bash@gnu.org |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=WIYaVxsE7w+9unrUgxJ2dJYNziN2LwmYe6WIRpmgsPM=; b=SoiQbOU/cfOcWIySfXvC7Y3E1b9Gs/gj6/9mfPCVNUxV5B1WIyyGst3ASST4dxG8ZK enDXnEpN7ErtiUqhmePHuM5sfXCiao21Mhf1u7sXeXq/JJxwoCslvMqCxMyE7tYlSpl5 +2qo5er4KgQhLLXfIYqE6lvHo+B4tTLknQWeU63htwNzsw/89NnbzWTUbdmRtMex7mCu j385ztUyT80aOKUDvdP2fe2Ccn13s8yiJL3mx/e5cOeSles6IZXC/EFXXaeHofmbwEAz 4pbq18as6FH2MR/8YUg390MZFvKdTgAJUtS5Kaz0NoqBeZ/+MLKcOw3pB5KnVHVfURcQ XfTg== |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=WIYaVxsE7w+9unrUgxJ2dJYNziN2LwmYe6WIRpmgsPM=; b=DWYdrtVcqtIg0N/lJ5ASAJepllRpnzvNpgw99kzJBe4+QIpyYHrD/ON/tzEOXVREgL eCWnYILr/YybIkx0aab0G5VZHkXPUD76ul63W0NCdyIDJHB/IEeTPlg/sIPKznOw/tnU mUg2bUbpHENKwrLerc4s1aSxj30aqkPlAKqfLGqrpq0/1yartJKkIfM+XGjKJduJzJcX Lub9ZH1+qGWntVJ+xc/4p1kxKQO94STOdWFyFcTyfANnTWhHPc8daS6NoxEkpyj8zA9v W4nzudtF7Xt1IzYaF8WOZFyJpdJ+epyMga/u5nimjCBaDjWEAUg8udVESHBunu1XPjq7 2p8g== |
| X-Gm-Message-State | AOUpUlHsZ094DMGM1It86D3c/SFw9nq68gcO3CdhxruVYezY03eqMB1m XUI3J+zRKQdD/3Ho2V9kS+zyOAqpDmBH6WOy8dOASkwwz6OXGg== |
| X-Google-Smtp-Source | AAOMgpeIj30ES60PE7vuzKsMv22GzO4X/OlCGLFIlTeOOx8xIS6lzy1GJmu2f6j2y3eIyZl2IC89+9sWObqW5dLJinM= |
| X-Received | by 2002:a19:1ad1:: with SMTP id a200-v6mr2117703lfa.49.1532632543029; Thu, 26 Jul 2018 12:15:43 -0700 (PDT) |
| In-Reply-To | <2e51ae31-5fb0-633b-6d7b-faab8df39585@case.edu> |
| X-detected-operating-system | by eggs.gnu.org: Genre and OS details not recognized. |
| X-Received-From | 2a00:1450:4864:20::12c |
| X-BeenThere | bug-bash@gnu.org |
| X-Mailman-Version | 2.1.21 |
| Precedence | list |
| List-Id | Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org> |
| List-Unsubscribe | <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe> |
| List-Archive | <http://lists.gnu.org/archive/html/bug-bash/> |
| List-Post | <mailto:bug-bash@gnu.org> |
| List-Help | <mailto:bug-bash-request@gnu.org?subject=help> |
| List-Subscribe | <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe> |
| Xref | csiph.com gnu.bash.bug:14402 |
Show key headers only | View raw
It seems that in general the array type is inherited just fine, there is an
issue only in the case that:
* the `A' attribute is inherited but not explicitly supplied
* we are creating the local variable with the `declare' command
(i.e. it is not already an existing local variable)
* we are performing a compound assignment/append operation in the
same declare command
For example, given:
shopt -s localvar_inherit
declare -A var=([X]=X)
These all work smoothly:
## no explicit `-A', no assignment in `declare':
f() { declare var; declare -p var; }; f
# declare -A var=([X]="X" )
f() { declare var; var=([Y]=Y); declare -p var; }; f
# declare -A var=([Y]="Y" )
f() { declare var; var+=([Y]=Y); declare -p var; }; f
# declare -A var=([X]="X" [Y]="Y" )
## explicit `-A', assignment in `declare':
f() { declare -A var=([Y]=Y); declare -p var; }; f
# declare -A var=([Y]="Y" )
f() { declare -A var+=([Y]=Y); declare -p var; }; f
# declare -A var=([X]="X" [Y]="Y" )
## non-compound assignment:
f() { declare var[Y]=Y; declare -p var; }; f
declare -A var=([X]="X" [Y]="Y" )
But here we have some issues:
## no explicit `-A', assignment in `declare':
f() { declare var=([Y]=Y); declare -p var; }; f
# Segmentation fault: 11
f() { declare var+=([Y]=Y); declare -p var; }; f
# Segmentation fault: 11
f() { declare var+=(); declare -p var; }; f
# declare -aA var=()
f() { declare var=(); declare -p var; }; f
declare -aA var=()
Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread
Re: segfault w/ localvar_inherit and associative array insert Grisha Levit <grishalevit@gmail.com> - 2018-07-26 15:15 -0400
csiph-web