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


Groups > gnu.bash.bug > #12021

Re: rewriting a readonly var should exit

From Chet Ramey <chet.ramey@case.edu>
Newsgroups gnu.bash.bug
Subject Re: rewriting a readonly var should exit
Date 2015-12-15 09:29 -0500
Message-ID <mailman.2156.1450189768.31583.bug-bash@gnu.org> (permalink)
References <566FF580.2060508@gandi.net>

Show all headers | View raw


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 12/15/15 6:12 AM, Aurelien ROUGEMONT wrote:

> Bash Version: 4.3
> Patch Level: 30
> Release Status: release
> 
> Description:
> 	in the posix shell specification [1] when a script tries to to
> overwrite a readonly variable it should crash the script.
> 
> Repeat-By:
>         #!/bin/bash
>         readonly rovar="goodvalue"
>         rovar="badvalue"
> 	echo "You should not see this message"
> 
> Fix:
> 	the bash interpreter should exit when the readonly var is being asked
> for an overwrite

The shell exits in this case when it is running in Posix mode.

- -- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iEYEARECAAYFAlZwI7IACgkQu1hp8GTqdKsyxACgk42MVS+jQeKSxZ6IoKQu0yaZ
ZDoAn3HrbC7JYivv3fOIS1akKf2XNFkh
=18vR
-----END PGP SIGNATURE-----

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


Thread

Re: rewriting a readonly var should exit Chet Ramey <chet.ramey@case.edu> - 2015-12-15 09:29 -0500

csiph-web