Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #16612 > unrolled thread

$SHELLOPTS after function with `local -'

Started byGrisha Levit <grishalevit@gmail.com>
First post2020-07-24 02:14 -0400
Last post2020-07-24 02:14 -0400
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  $SHELLOPTS after function with `local -' Grisha Levit <grishalevit@gmail.com> - 2020-07-24 02:14 -0400

#16612 — $SHELLOPTS after function with `local -'

FromGrisha Levit <grishalevit@gmail.com>
Date2020-07-24 02:14 -0400
Subject$SHELLOPTS after function with `local -'
Message-ID<mailman.449.1595571272.24492.bug-bash@gnu.org>
The value of $SHELLOPTS is not always updated correctly after returning
from a function that modifies options after using `local -'.

For example:

    fun() { local -; set -u; }; fun
    [[ $- == *u* ]]; echo $?                        # 1
    [[ :$SHELLOPTS: == *:nounset:* ]]; echo $?      # 0

This seems to be the case for the following set of options:
interactive-comments, keyword, monitor, noclobber, noglob, nolog, notify,
nounset, onecmd, physical, pipefail, privileged, verbose, xtrace

While it works correctly for:
allexport, braceexpand, emacs, errexit, errtrace, functrace, hashall,
histexpand, history, ignoreeof, noexec, posix, vi

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web