bug-bash
[Top][All Lists]
Advanced

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

Re: $SHELLOPTS after function with `local -'


From: Grisha Levit
Subject: Re: $SHELLOPTS after function with `local -'
Date: Fri, 24 Jul 2020 17:00:04 -0400

On Fri, Jul 24, 2020 at 4:21 AM Oğuz <oguzismailuysal@gmail.com> wrote:
> What version of bash is this? I can't reproduce the bug on 5.0.11.

Good point, this was with the latest devel branch, though the behavior can
be seen in the release version for the privileged, verbose and xtrace
options. The change was in [1].

The propblem is that SHELLOPTS was only being (partially) reset somewhat by
accident, since the functions that handle `posix' and `ignoreeof' options
hapen to call set_shell_opts. (Prior to the change above, the posix mode
code would do this unconditionally but now it does only when the value did
actually change).

The diff below should do the trick.

[1]: 
https://git.savannah.gnu.org/cgit/bash.git/diff/builtins/set.def?h=devel&id=091c6bc481bd2b405e39b6ad5967eb4fa2aab597


diff --git a/builtins/set.def b/builtins/set.def
index 48927679..cf48230e 100644
--- a/builtins/set.def
+++ b/builtins/set.def
@@ -373,6 +373,8 @@ set_current_options (bitmap)

   /* Now reset the variables changed by posix mode */
   set_posix_options (bitmap+i);
+
+  set_shellopts();
 }

 static int



reply via email to

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