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


Groups > gnu.bash.bug > #16615

Re: $SHELLOPTS after function with `local -'

Path csiph.com!4.us.feeder.erje.net!feeder.erje.net!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail
From Grisha Levit <grishalevit@gmail.com>
Newsgroups gnu.bash.bug
Subject Re: $SHELLOPTS after function with `local -'
Date Fri, 24 Jul 2020 17:00:04 -0400
Lines 34
Approved bug-bash@gnu.org
Message-ID <mailman.508.1595624420.24492.bug-bash@gnu.org> (permalink)
References <CAMu=BrqQwOGPL09TJcPJXcugwHeDeeHCtmxyuS=faLJZLymCrw@mail.gmail.com> <CAH7i3LqQYjf+-vRnW+AZACBzgyuV_AwnE_-CLA1d+dg6-t3uCA@mail.gmail.com> <CAMu=BrojafM7-G0MzrnHpdxgUNvEDg9c4tBOstYHze=+x6jq8g@mail.gmail.com>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
Content-Transfer-Encoding quoted-printable
X-Trace usenet.stanford.edu 1595624420 13361 209.51.188.17 (24 Jul 2020 21:00:20 GMT)
X-Complaints-To action@cs.stanford.edu
Cc bug-bash <bug-bash@gnu.org>
To Oğuz <oguzismailuysal@gmail.com>
Envelope-to bug-bash@gnu.org
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=U3OTwy0plOxFBlP1WvqlFEC5umr/5z9czpXlq9q68z8=; b=FWzLiWkSMvyOMdt+P1BiI6EI0jtJmlaBrHqDNxBosGR1rF+OwzAkWdZN9saDxV9wV5 WtQSHVPK+cJd2uUjTix5HQuzqkye465/Jy/BGsnvzLwmHebAzea4chaN5kUgxibo3SLs Jf3iTAu/gJIvpmBmfSHf24go+pHRnInODjTZwkaZiqaCOjRVg2ng3b9SLFxwKyH/9HN6 Ig6Mm0GQoDJFuNXQ0OKfA8uYA0d4qQzhk7Gf6GCBuaNBXdfSlQ/MGxV7QibQytVO9GvU 0xjUSvbkFh6QD8LC1TC56RBFgTHHAhw0eeWyq65NiA+iRZTaubZdf1RqC8QQjExZa9Jp +JyQ==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=U3OTwy0plOxFBlP1WvqlFEC5umr/5z9czpXlq9q68z8=; b=P12YAZdDS4VncP9MN4KUTPCLx4ySahy/P74Ue/c0Ro+ms/xNeiI1Ji5k08yYQonrYC 9OxsQQ8Nn/bZ9SL+IE21TayOxMSl5/zYN6HgLZ01p3l2qFQrLpvloreuWKYyQUNNXdxU tflLw3gvFm7xRhBtTHR6+YyLjgqza4ioz/fuqodJFx8KkJmkDEBbNjWgn/d6PN53x52M h30uITA3o1W47VAZJgTNUIXKoGcPy2L0uWsJTWJVsIZaLG8jj3Amv55SZSzAmuXYIw2n Jwh8mJxa2DIsp9dmzUWRdsA3wklDdbNHIhGVTrLxMShBQr0O+q4o8z9Mid2lN15Ph4+r NXiA==
X-Gm-Message-State AOAM533GGHmmtDs5IwHxI31JNcCrf4RrLoK57jQ6dr8RWJ948KddU70O 37Klkx/0agt68n1MqvoDTM/y5BozFXrDVdB16iI=
X-Google-Smtp-Source ABdhPJzMvEiKiD5lEh22PAimzF+qgujIu0bry5Zd0PqSxlF68ViWr2nWIROIUTf57LhDHqneywN4k077GB1SiEUkhaU=
X-Received by 2002:a37:458f:: with SMTP id s137mr12501840qka.129.1595624415081; Fri, 24 Jul 2020 14:00:15 -0700 (PDT)
In-Reply-To <CAH7i3LqQYjf+-vRnW+AZACBzgyuV_AwnE_-CLA1d+dg6-t3uCA@mail.gmail.com>
Received-SPF pass client-ip=2607:f8b0:4864:20::744; envelope-from=grishalevit@gmail.com; helo=mail-qk1-x744.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=BrojafM7-G0MzrnHpdxgUNvEDg9c4tBOstYHze=+x6jq8g@mail.gmail.com>
X-Mailman-Original-References <CAMu=BrqQwOGPL09TJcPJXcugwHeDeeHCtmxyuS=faLJZLymCrw@mail.gmail.com> <CAH7i3LqQYjf+-vRnW+AZACBzgyuV_AwnE_-CLA1d+dg6-t3uCA@mail.gmail.com>
Xref csiph.com gnu.bash.bug:16615

Show key headers only | View raw


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

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


Thread

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

csiph-web