[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
pop_var_context msg when eval code with errexit set
From: |
Xavier Delaruelle |
Subject: |
pop_var_context msg when eval code with errexit set |
Date: |
Wed, 12 Oct 2022 06:58:27 +0200 |
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -g -O2
uname output: Linux mosaic 5.18.17-200.fc36.x86_64 #1 SMP
PREEMPT_DYNAMIC Thu Aug 11 14:36:06 UTC 2022 x86_64 x86_64 x86_64
GNU/Linux
Machine Type: x86_64-pc-linux-gnu
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
Regards,
Xavier
- pop_var_context msg when eval code with errexit set,
Xavier Delaruelle <=