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


Groups > gnu.bash.bug > #11933

Re: An array variable created by export/readonly builtins inside a function becomes a locale variable to that function unexpectedly

Path csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!usenet.stanford.edu!not-for-mail
From Piotr Grzybowski <narsil.pl@gmail.com>
Newsgroups gnu.bash.bug
Subject Re: An array variable created by export/readonly builtins inside a function becomes a locale variable to that function unexpectedly
Date Sat, 28 Nov 2015 10:43:15 +0100
Lines 20
Approved bug-bash@gnu.org
Message-ID <mailman.858.1448703800.31583.bug-bash@gnu.org> (permalink)
References <70266BC6-C65A-4D95-B7C1-2F63F3C45DEF@qq.com>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace usenet.stanford.edu 1448703800 19956 208.118.235.17 (28 Nov 2015 09:43:20 GMT)
X-Complaints-To action@cs.stanford.edu
Cc bug-bash <bug-bash@gnu.org>
To ziyunfei <446240525@qq.com>
Envelope-to bug-bash@gnu.org
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=CixSWUeAnYLNW+5pR70kLprB3h+WT2+CqdfRIZbDNYk=; b=RIo8tKbKOBx7n9NfqwS1+O3wfIuc5hnD6TkhrrCgf48nSMtp4KE0uB8J/Pa2K+3NEa eIeyBz1iNaifhKzdb0m6Cxqv6ln2v8T4CsrfK6zgpvhvcUAE8lcQzJFtWapTXVwgI3iv zb8XJA9O1bM/o6K0ZJT9HlYqbcVsyi4hU8NNU2KLkSZVQlW94q8sO8IlzIS2vFOATz7U SCnaD4eqgiNhWnvhfPIS3yirBREQZ4k3yN2b9m1GJbcCislGK1GM5G8Ag+0GoGfxnM/c /++LXltKGzqUypv/M9eKqW+vxXeBDhBsJr2c6nyz7XtiE1h5EraAD+w4ZExDKTivi+qm 1Lkw==
X-Received by 10.25.208.206 with SMTP id h197mr22169908lfg.153.1448703795660; Sat, 28 Nov 2015 01:43:15 -0800 (PST)
In-Reply-To <70266BC6-C65A-4D95-B7C1-2F63F3C45DEF@qq.com>
X-detected-operating-system by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value).
X-Received-From 2a00:1450:4010:c07::22a
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.14
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:11933

Show key headers only | View raw


hey,

 this is triggered by (), since the following works as "expected":

bash -c 'foo() { readonly a=1; echo a=$a; }; foo; echo a=$a'

 cheers,
pg


On Sat, Nov 28, 2015 at 4:18 AM, ziyunfei <446240525@qq.com> wrote:
> $ ksh -c 'foo() { readonly a=(1);echo a=$a; }; foo; echo a=$a'
> a=1
> a=1
> $ bash -c 'foo() { readonly a=(1);echo a=$a; }; foo; echo a=$a' # a becomes a local variable
> a=1
> a=
>
>

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


Thread

Re: An array variable created by export/readonly builtins inside a function becomes a locale variable to that function unexpectedly Piotr Grzybowski <narsil.pl@gmail.com> - 2015-11-28 10:43 +0100

csiph-web