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


Groups > gnu.bash.bug > #14828

Misbehavior with constants and bash script

Path csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail
From Alexander Reintzsch <Alexander.Reintzsch@netsystem.de>
Newsgroups gnu.bash.bug
Subject Misbehavior with constants and bash script
Date Mon, 19 Nov 2018 20:04:21 +0000
Lines 91
Approved bug-bash@gnu.org
Message-ID <mailman.4270.1542662930.1284.bug-bash@gnu.org> (permalink)
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="K4FuowRCbC3PK1A9VBcmp4bAYhn8CleA5"
X-Trace usenet.stanford.edu 1542662931 26571 208.118.235.17 (19 Nov 2018 21:28:51 GMT)
X-Complaints-To action@cs.stanford.edu
To "bug-bash@gnu.org" <bug-bash@gnu.org>
Envelope-to bug-bash@gnu.org
Thread-Topic Misbehavior with constants and bash script
Thread-Index AQHUgEMP54SJp6hR+0aak96ssHT2kQ==
Accept-Language de-DE, en-US
Content-Language de-DE
X-MS-Has-Attach yes
X-MS-TNEF-Correlator
user-agent Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1
x-ms-exchange-messagesentrepresentingtype 1
x-ms-exchange-transport-fromentityheader Hosted
x-originating-ip [10.121.1.226]
X-detected-operating-system by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From 85.13.147.64
X-Mailman-Approved-At Mon, 19 Nov 2018 16:28:50 -0500
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:14828

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

Hello,

I think I have found some unexpected behavior related to constants in
bash scripts. I have attached the short proof of concept bash script.

Usually bash scripts continue when they face an error with one command
but this script shows some weired behavior. It exits all the functions
it has called without executing the remaining commands and the continues
to run in the top scope of the script.

This only happens when a constant declared with
declare -r myConst="myConstantValue"
is attempted to be redefined using
myConst="new value"
but not with
declare myConst="new value"

This behavior doesn't seem right.

I have tried this on Ubuntu 16.04 LTS with bash version
GNU bash, Version 4.3.48(1)-release (x86_64-pc-linux-gnu)

Cheers,
Alex

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


Thread

Misbehavior with constants and bash script Alexander Reintzsch <Alexander.Reintzsch@netsystem.de> - 2018-11-19 20:04 +0000

csiph-web