Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14899

assignment to a nameref that resolves to the temporary environment

Path csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail
From Grisha Levit <grishalevit@gmail.com>
Newsgroups gnu.bash.bug
Subject assignment to a nameref that resolves to the temporary environment
Date Sun, 9 Dec 2018 01:28:22 -0500
Lines 12
Approved bug-bash@gnu.org
Message-ID <mailman.5421.1544336916.1284.bug-bash@gnu.org> (permalink)
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
X-Trace usenet.stanford.edu 1544336917 1944 208.118.235.17 (9 Dec 2018 06:28:37 GMT)
X-Complaints-To action@cs.stanford.edu
To bug-bash <bug-bash@gnu.org>
Envelope-to bug-bash@gnu.org
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=V/HOCIRZOzEDfXMsbUj2tIBiTy7SXNBhTV1TD4VTrgY=; b=vIhMuB2Yt+TzI7m6nvx0/trQh8rzPXE0loDym6PKYyU50oWA8BMmtZ3bPk8cCSnYG0 cdLroUAAjB2UPgVCjFDDIpjdHMERE1i08W5ofYAF7CW9DxGvu4R0ZGu1nfT5/lPXjrz1 QEVoz14+KDCI8P9s2DJINsfONEh3ZphjwJzz8UzPwxQbIx+nS4ohSCOJ5cj/COv65FFv lMmVL4oGBa0G6hKq7lZYvTaTJAC+x7moaC6MXUYG8jxYdEyJPkCXk6A1tK843gkvFpGR UKnhPqeuI3+wL6Teufzw35cPXMKrlGnkQXXxHUIIfYCtthLxWRlKbcn2GwDIYGumnzNr frDw==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=V/HOCIRZOzEDfXMsbUj2tIBiTy7SXNBhTV1TD4VTrgY=; b=iyokmzj1FDRRv6simsOl+u7SM+FrbHtiBHn4lkOqtpnzggHo2Mc+gTU6SIgbi365a4 rkf1mq8QIJueKFxqihJW57QcAaNw5Jw5X0aB0BePdVFeak5b1LKj6xvqLCpM9KOfC7vj SoQGMlb4HqsSu2DRjFxzQPJhXxtAD89SRULzZkAVQHSGqMeOJB92i8OsUTYhy8irgwxq S52mUCmgqpTM62czLaSdTMtC2H5iHe00sihPMlE5sWdr5k4z8MXMMNe0/KhCF+oKrcBR J32+XO1jR8maRXZtjqIb63V5zX95HLnBp063aRLAitGDmhH5Wxk4MsQc9aSARUaKaR2h mSog==
X-Gm-Message-State AA+aEWb+4BlpBEoWMIDmGHPNaKVW6haJlrtf6ERQceDckhT8KnQW4wK9 BBwcetvQw5ELR2cXutCEY+tkzNWced5/VekVVKrSnCZ1
X-Google-Smtp-Source AFSGD/W9DhFe1Y0lXp1/UgAc6f6jzCESTAKtAb+A1BYmYFtq5lQZcU0wqVpIlZ2y8ac9QJ8fxMFiYvswyfIMogq8HD4=
X-Received by 2002:a0c:9549:: with SMTP id m9mr7547895qvm.214.1544336913751; Sat, 08 Dec 2018 22:28:33 -0800 (PST)
X-detected-operating-system by eggs.gnu.org: Genre and OS details not recognized.
X-Received-From 2607:f8b0:4864:20::832
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:14899

Show key headers only | View raw


When a nameref local to a higher function scope points to a variable in the
temporary environment, that nameref (correctly, it seems) expands to the
value
of the target variable from the temporary environment. However, assignment
to
the nameref modifies the variable from the higher scope, bypassing the
tempenv:

    $ a() { local -n ref=var; var=tmp b; echo $ref; }
    $ b() { ref=$ref; }
    $ var=foo; a
    tmp

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

assignment to a nameref that resolves to the temporary environment Grisha Levit <grishalevit@gmail.com> - 2018-12-09 01:28 -0500

csiph-web