[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: pop_var_context msg when eval code with errexit set
From: |
Chet Ramey |
Subject: |
Re: pop_var_context msg when eval code with errexit set |
Date: |
Wed, 12 Oct 2022 10:25:05 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 |
On 10/12/22 12:58 AM, Xavier Delaruelle wrote:
Bash Version: 5.2
Patch Level: 2
Release Status: release
Description:
Starting version 5.2, when evaluating bash code (with eval builtin
command) with 'errexit' option set, a pop_var_context message appears
if the evaluating code leads to an error:
test_script: line 5: pop_var_context: head of shell_variables not
a function context
See the reproducer test code in Repat-By section.
I work on a project that provides a bash function in user
environment (https://modules.sourceforge.net/). This function produces
bash shell code that is evaluated in current shell session to update
it. When
users run their script in 'errexit' mode, I would expect not to obtain
this pop_var_context message, like in previous bash versions.
I first detected this issue on FreeBSD 13-1, but I have also
reproduced it on a Linux environment.
Repeat-By:
Script to reproduce the issue:
```test_script
myfunc() {
eval "test 0 = 1;"
}
cmd="myfunc"
eval "$cmd"
```
Then run this test script with 'errexit' option set:
$ ./bash -e test_script
test_script: line 5: pop_var_context: head of shell_variables not
a function context
It's an internal message warning that something might be wrong. We'll see
if something is.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/