bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: local -r issue in conjunction with trap


From: Koichi Murase
Subject: Re: local -r issue in conjunction with trap
Date: Sat, 16 Jul 2022 08:06:20 +0900

2022年7月16日(土) 7:28 Lawrence Velázquez <vq@larryv.me>:
> You can't shadow a readonly variable:
>
> https://lists.gnu.org/archive/html/bug-bash/2019-03/msg00152.html
> https://lists.gnu.org/archive/html/bug-bash/2019-03/msg00153.html
> https://lists.gnu.org/archive/html/bug-bash/2020-04/msg00201.html
> https://lists.gnu.org/archive/html/bug-bash/2020-04/msg00204.html

We can shadow local readonly variables. What we cannot are global
readonly variables.

It seems to me a bug. While the following works,

$ bash-dev -ec 'T(){ local -r v=; }; trap T 0; F() { local -r v=; exit; }; F'

the following fails

$ bash-dev -e <<< 'T(){ local -r v=; }; trap T 0; F() { local -r v=; exit; }; F'
main: line 1: local: v: readonly variable

Tested on the current devel 87a6e89e (+ define(relstatus, release) in
configure.ac)

--
Koichi



reply via email to

[Prev in Thread] Current Thread [Next in Thread]