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


Groups > gnu.bash.bug > #16612

$SHELLOPTS after function with `local -'

Path csiph.com!goblin2!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail
From Grisha Levit <grishalevit@gmail.com>
Newsgroups gnu.bash.bug
Subject $SHELLOPTS after function with `local -'
Date Fri, 24 Jul 2020 02:14:16 -0400
Lines 17
Approved bug-bash@gnu.org
Message-ID <mailman.449.1595571272.24492.bug-bash@gnu.org> (permalink)
References <CAMu=BrqQwOGPL09TJcPJXcugwHeDeeHCtmxyuS=faLJZLymCrw@mail.gmail.com>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
X-Trace usenet.stanford.edu 1595571272 6251 209.51.188.17 (24 Jul 2020 06:14:32 GMT)
X-Complaints-To action@cs.stanford.edu
To bug-bash <bug-bash@gnu.org>
Envelope-to bug-bash@gnu.org
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=RPS/0zDIe/ni4QD3oDkAOqHijD16K5ABY/0QKIqpLh0=; b=JjP6O0m20ObtN+24bQLRT3DUMm1KUnqqJFVi0oXoNldpvvE/r/tiDf7KlIO3NNriEN hQwC3Qq1XAakvtYJrSHPPjvLbBa8VSQX25kEz4iAwlO6PYUhSCKxoScBan/S+PC4z7RT L/T21MG4Rn9KUYZeB6pxhWQRZd7WQAf5A2kG2Fwl0kKnYGuchmQ3KzMf/gMT/3lUw9NS ByyXxYmb7LsOeG6QZ+hsRCwjj8h9UhnkWe5o5NqaIiJBdVz+1FxzzgzvlZNCjvXZq18D oHp8yTDBD0HjQl8IXmXhojDsBq+K99pblATvvtOggDl9kh4QFNKh1TfIqjglYzCcNmHD 3YlQ==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=RPS/0zDIe/ni4QD3oDkAOqHijD16K5ABY/0QKIqpLh0=; b=jm0kNTfhJznUov8rglPvo/fRddGslqpIgUMXGDbBZC78QrAPwg0xI9CZC0WTIk84F1 hruV7Uu26R9reHjZla+/3fIk4LlHbzdPy9d/cQBV0bgJ5eL3HwyRtwqb94tddGVF7EUX DKFi2krMWkA25io1Ve3BxDpD5megSpfPs+HeNS8M5h+tzwp//PKqnjf1VYoWET4h7L/A MuJyC9x1X3ZDpTvBJK4rODWEbAHvgXq4V/YRyG5Y5Bjy21HC+iWj74AL1F2ihDScgxeA XD+L6kv94YsMyOiWZkf6XYiLAeSowQKl5Qx/nPoaiM+2wiJj366PaW7tNp7zEh5LlSsf U8Jw==
X-Gm-Message-State AOAM531v17j3fp1WDrSQ2DouuJ7nUCtlO+AcgUIELo9MTaC+AjGEbLTH 3hvezMXN/1kEbVny8RuUybqmMJgJfSeDY1yVQweM7+EKD/s=
X-Google-Smtp-Source ABdhPJwaE3/xpSCsiMLWmr39DMRANgK1c4vbGSsy3sSQQfG1ZDJ1wvWGyWind3Nx+sxdBYEoLSnDx15TSBwI9POjGqw=
X-Received by 2002:ac8:32b8:: with SMTP id z53mr7834970qta.273.1595571267555; Thu, 23 Jul 2020 23:14:27 -0700 (PDT)
Received-SPF pass client-ip=2607:f8b0:4864:20::82a; envelope-from=grishalevit@gmail.com; helo=mail-qt1-x82a.google.com
X-detected-operating-system by eggs.gnu.org: No matching host in p0f cache. That's all we know.
X-Spam_score_int -20
X-Spam_score -2.1
X-Spam_bar --
X-Spam_report (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action no action
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.23
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <https://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
X-Mailman-Original-Message-ID <CAMu=BrqQwOGPL09TJcPJXcugwHeDeeHCtmxyuS=faLJZLymCrw@mail.gmail.com>
Xref csiph.com gnu.bash.bug:16612

Show key headers only | View raw


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

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

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

csiph-web