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


Groups > gnu.bash.bug > #14900

should `local' create local variables when they exist in the tempenv?

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 should `local' create local variables when they exist in the tempenv?
Date Sun, 9 Dec 2018 01:30:53 -0500
Lines 16
Approved bug-bash@gnu.org
Message-ID <mailman.5422.1544337070.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 1544337071 2000 208.118.235.17 (9 Dec 2018 06:31:11 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=bykc1/UJbn+FYRFjNBIBH+6+yKd3VzvjAvkv/HcfQy0=; b=H5dGMlx2V7/yCVqGKgqP/YZiOwcqF3VnWfmnNAD/QLPxvY9xmbpy4NMqcH9YGAWqrh wqVpTFHFjcIt4c+VuSfng9Usvo/KfMteuKd6QYqjzzDsQO0/1oLc1SDrrUd9f9x2IAlW ZfS88bZ9BpA93MSw+KecbGw00E0Hn8pXzPN+OFBbH0hoHSjzUCnWACejbG+AU+KMj1mM sprXI88XaZ3/gLp82x7Rf9bJpnNuIgwd75St85NE59HSr9xFPrqVTB1neqBPCRRYYZDC /vfNFKg2bUTClbi/myKYEoYqjnXTDSt7x2HVT24OTJfAzNjsWd/qIXaiJ5rZZ5d016Ud H/wg==
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=bykc1/UJbn+FYRFjNBIBH+6+yKd3VzvjAvkv/HcfQy0=; b=mNkfoggT/6E1ldPRYVgrX4xXyHcYXs9/5OfoN5vKBxHdsyPu5973Kwr62Omh73+zut Dabcf1AKHJePrCM8miZgms0M/0++BTZQRCMom7H4M8lnTotvMJRtOoQt0cdKvDT8he+P pbLVxAGFpPCHrwwffRWFwAeeG1rM6poEMLrtT8TZUTrZcs8grOysPgDVtgn+XhT1YqaF zAzjhQsTQPQExEOQhdwywmGdvveSKCYlh+zeQTiDZJQY5tgRmujLhNVQ3s38roLk94Ji FHPpVHsSOrmGt0HzqcLIArWfouv/ZWo+KBm/KYLObbG5Y1nxJWOOtLrGWwSYJzTpkKvw DNpQ==
X-Gm-Message-State AA+aEWYECLf/zMezqYZilLH7wo44BmKJnBBEoOV4TQbep10leqkGg6up 1gNX9WopJi3ZKYkH+Vt5/AhW1ahFoAQqnx6PUaI4P16W
X-Google-Smtp-Source AFSGD/X4KQEt0ZWVUp2bi1fpTvMaKcuzSYUm9ufe/8xREYbg46x1ocMrNwRwax2BYdyU2+qr/Qxu2NA3diReC36nfaU=
X-Received by 2002:ac8:674b:: with SMTP id n11mr7649394qtp.104.1544337064430; Sat, 08 Dec 2018 22:31:04 -0800 (PST)
X-detected-operating-system by eggs.gnu.org: Genre and OS details not recognized.
X-Received-From 2607:f8b0:4864:20::82a
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:14900

Show key headers only | View raw


When a variable is present in the temporary environment and then declared
local in a function, it seems to not actually make a local variable, in the
sense that the variable does not show up in the output of `local',
unsetting
the variable reveals the variable from the higher scope rather than marking
it invisible, etc.

    $ f() { local v=x; local -p; }; v=t f

    $ f() { local v; declare -p v; }; v=t f
    declare -x v="t"

    $ f() { local v=x; unset v; declare -p v; }; v=g; v=t f
    declare -- v="g"

Is this intentional?

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


Thread

should `local' create local variables when they exist in the tempenv? Grisha Levit <grishalevit@gmail.com> - 2018-12-09 01:30 -0500

csiph-web