Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #14457
| Path | csiph.com!3.us.feeder.erje.net!feeder.erje.net!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 | Mon, 6 Aug 2018 18:46:17 -0400 |
| Lines | 16 |
| Approved | bug-bash@gnu.org |
| Message-ID | <mailman.4775.1533595593.1292.bug-bash@gnu.org> (permalink) |
| References | <CAMu=BroMwXaqDTT3qusycRGRdXevmxiwC0RpR8+wGooo83pWgg@mail.gmail.com> <2e51ae31-5fb0-633b-6d7b-faab8df39585@case.edu> <CAMu=Brpvrg2GHwy8zs5hiWN_cReUupa=014JmfCNKMxaJws2Bw@mail.gmail.com> <54c2fc17-c47f-ed94-23a5-8f23f3c6cb87@case.edu> <CAMu=BrpQUf9U5qdAiojH6oGjAkUx_PPw-sZWdxcricpvsgkY2w@mail.gmail.com> <6ff6c1f7-1250-c484-b0ee-60c79dee46d0@case.edu> |
| NNTP-Posting-Host | lists.gnu.org |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="UTF-8" |
| X-Trace | usenet.stanford.edu 1533595593 11581 208.118.235.17 (6 Aug 2018 22:46:33 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=7/GO1yNhMLNymGgT6RaNCyYe4rQ0Thsh77Hml1WUqRY=; b=Lol0FGTMCbodDrQbxvB8QTLSfKAm+jBePaL//RAwCxVGcSa7yneY6Dnk9hSDDbK9TW bgppufpaEL9VCP0PvtGiI/jQKQ/uKQzzaw1cuP40vTc5GAgxscI6DFHWH68AlXxyVQMD 093zpuPTI8HxRu40/XihJmFL0d3F+HXhnBoR3q6CAuBB028tijxWSrxqw2Tade9BqBrE YkBckTY4m3v8DMVcXw6+fJkaKEBZpCoOqnB4dNIr+AkEd6LtjdFKXuUz4L+wujAJe11S H5Emg61fwPYdXx9E8mBWEMWFnr+jmgwhSFzyD02mfvOLHJlsX1/2GmX4uSNAxjpAZZS+ agXg== |
| 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=7/GO1yNhMLNymGgT6RaNCyYe4rQ0Thsh77Hml1WUqRY=; b=JBm//gWrRRkeR/LyDx/KZ9XDKGeMA6ixC4FfTwi5AbC+QVaHL7ooGpu59u2d1dposu UynH0o/zVMvv5g4kGOKOsp1Ls2pNHlSkq1vvr0pS7hN+2/17A7dnp13tLskgn2dgUotp rFPwqORwmOcuc1XA01vCwMBUb0LlWzjCR2QKqfxM/8qTquAPu9nlIDgobhZVGbdiX82T Tat8IRVk06jhAbl4xOQqXGVbABRNlPYyR5+nRoQ/kw1f4arZuB3ZGimee4WDHuDCduqE ys1WaBoW3sJtVd6fHXemnQ+IcvWNDKZP0t4c2QKbO7Wj3VdhcwsFl3posdvhxZJazSjB iMEQ== |
| X-Gm-Message-State | AOUpUlGjTGP+rMWsg3vYAUHbRcNG6xCcfe52Vm2YY23z0izL0TEBm0I7 /J9CI3QXGlvuaEa7QVHINPODV9S8vRrjJJyDWvk= |
| X-Google-Smtp-Source | AA+uWPwNCf8mlyDt1I6OKVfk20wqwifYlKEYSEDKow69rITpk8CokzvpbPniyn+3s21VUH0DyqJziDQxWtzt9fYkj40= |
| X-Received | by 2002:ac8:354e:: with SMTP id z14-v6mr2852348qtb.139.1533595588673; Mon, 06 Aug 2018 15:46:28 -0700 (PDT) |
| In-Reply-To | <6ff6c1f7-1250-c484-b0ee-60c79dee46d0@case.edu> |
| X-detected-operating-system | by eggs.gnu.org: Genre and OS details not recognized. |
| X-Received-From | 2607:f8b0:400d:c0d::22c |
| X-Content-Filtered-By | Mailman/MimeDel 2.1.21 |
| 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:14457 |
Show key headers only | View raw
I don't know if this makes consistency easier or harder, but there is
currently code to handle `declare' with -[iluc] early [1]. As a result, a
combination of localvar_inherit and the use of one of those options when
declaring a local variable allows (correctly or not) for associative arrays
to inherit their previous value and have elements inserted at the same time:
$ declare -A A; A[X]=X
$ f() { local -u A+=([Y]=Y); declare -p A; }; f
declare -Au A=([X]="X" [Y]="Y" )
$ f() { local -u +u A+=([Y]=Y); declare -p A; }; f
declare -A A=([X]="X" [Y]="Y" )
$ f() { local A+=([Y]=Y); declare -p A; }; f
-bash: warning: A: cannot inherit value from incompatible type
[1]
https://git.savannah.gnu.org/cgit/bash.git/tree/subst.c?h=devel&id=057a9fbdb4d9ad01b000743fcea9918b80823afc#n11199
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-08-06 18:46 -0400
csiph-web