Can not declare a local variable if an global ro-variable exists with the same name

2019-03-29 Thread joergboe
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-redhat-linux-gnu' 
-DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL 
-DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib   -O2 -g -pipe -Wall 
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong 
--param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic
uname output: Linux ocde150562 3.10.0-957.10.1.el7.x86_64 #1 SMP Thu Feb 7 
07:12:53 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-redhat-linux-gnu

Bash Version: 4.2
Patch Level: 46
Release Status: release

Description:
If I declare a global read-only variable and I try to declare a local 
variable with that name, I can not create
the local variable.
I expect that local variables can be declared independently for the 
global variables.

Repeat-By:
$ declare -r var=55
$ myfunction() {
> local var=11
> echo "\$var=$var"
> return 0
> }
$ myfunction
bash: local: var: readonly variable
$var=55





[Assignements to variables with integer attribute are expanded recursively]

2025-01-08 Thread joergboe--- via Bug reports for the GNU Bourne Again SHell
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 
-fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables 
-fstack-clash-protection -Werror=return-type -flto=auto -g  -D_GNU_SOURCE 
-DRECYCLES_PIDS -Wall -g -Wuninitialized -Wextra -Wno-switch-enum 
-Wno-unused-variable -Wno-unused-parameter -Wno-parentheses -ftree-loop-linear 
-pipe -DBNC382214=0 -DIMPORT_FUNCTIONS_DEF=0 
-DDEFAULT_LOADABLE_BUILTINS_PATH='/usr/lib64/bash'
uname output: Linux pluto 6.12.8-1-default #1 SMP PREEMPT_DYNAMIC Thu Jan  2 
12:47:33 UTC 2025 (ab2dfe6) x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-suse-linux-gnu

Bash Version: 5.2
Patch Level: 37
Release Status: release

Description:
[Assignments to variables with attribute 'integer' behave unexpectedly 
if the right side has not an integer value.
It seems that the value is interpreted as a variable name and expansion 
is done recursively.
This is not what I would expect.]

Repeat-By:
[
> aa=123456
> x=aa
> declare -i i=x
> echo $i
123456
]