Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #14357
| Path | csiph.com!feeder.erje.net!1.eu.feeder.erje.net!fu-berlin.de!usenet.stanford.edu!not-for-mail |
|---|---|
| From | Greg Wooledge <wooledg@eeg.ccf.org> |
| Newsgroups | gnu.bash.bug |
| Subject | Re: delcare -a on a nameref in a function modifies nameref instead of target |
| Date | Wed, 18 Jul 2018 08:23:03 -0400 |
| Lines | 25 |
| Approved | bug-bash@gnu.org |
| Message-ID | <mailman.3753.1531916620.1292.bug-bash@gnu.org> (permalink) |
| References | <CAMu=BrqTimtENjRABPgRdDhn5bQG2zBMv5YfQsNQDETh6oAjeQ@mail.gmail.com> |
| NNTP-Posting-Host | lists.gnu.org |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| X-Trace | usenet.stanford.edu 1531916620 17080 208.118.235.17 (18 Jul 2018 12:23:40 GMT) |
| X-Complaints-To | action@cs.stanford.edu |
| Cc | bug-bash <bug-bash@gnu.org> |
| To | Grisha Levit <grishalevit@gmail.com> |
| Envelope-to | bug-bash@gnu.org |
| Mail-Followup-To | Grisha Levit <grishalevit@gmail.com>, bug-bash <bug-bash@gnu.org> |
| Content-Disposition | inline |
| In-Reply-To | <CAMu=BrqTimtENjRABPgRdDhn5bQG2zBMv5YfQsNQDETh6oAjeQ@mail.gmail.com> |
| User-Agent | NeoMutt/20170113 (1.7.2) |
| X-detected-operating-system | by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] |
| X-Received-From | 139.137.100.1 |
| 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:14357 |
Show key headers only | View raw
On Tue, Jul 17, 2018 at 05:47:20PM -0400, Grisha Levit wrote:
> At global scope this works as expected:
>
> $ declare -n ref=var; declare -a ref=(X); declare -p ref var
> declare -n ref="var"
> declare -a var=([0]="X")
>
> But in a function, we end up with the nameref variable having both the
> `a' and `n' attributes and nothing in the target:
>
> $ f() { declare -n ref=var; declare ref=(X); declare -p ref var; }; f
> declare -an ref=([0]="X")
> -bash: declare: var: not found
FYI that one is already fixed in 5.0-alpha:
wooledg:~$ declare -n ref=var; declare -a ref=(X); declare -p ref var
declare -n ref="var"
declare -a var=([0]="X")
wooledg:~$ f() { declare -n ref=var; declare ref=(X); declare -p ref var; }; f
declare -an ref=([0]="X")
declare -a var=([0]="X")
Or at least partly fixed. *shrug*
Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread
Re: delcare -a on a nameref in a function modifies nameref instead of target Greg Wooledge <wooledg@eeg.ccf.org> - 2018-07-18 08:23 -0400
csiph-web