Re: git: 12e0d316644a - main - vendor/bc: upgrade to version 7.0.0

From: Herbert J. Skuhra <herbert_at_gojira.at>
Date: Sat, 14 Sep 2024 09:10:44 UTC
On Thu, 05 Sep 2024 19:44:16 +0200, Cy Schubert wrote:
> 
> In message <202408261628.47QGSD1E072637@gitrepo.freebsd.org>, Stefan 
> =?utf-8?Q?
> E=C3=9Fer?= writes:
> > The branch main has been updated by se:
> >
> > URL: https://cgit.FreeBSD.org/src/commit/?id=12e0d316644a4f80f5f1f78cf07bd93d
> > ef43b1ca
> >
> > commit 12e0d316644a4f80f5f1f78cf07bd93def43b1ca
> > Author:     Stefan Eßer <se@FreeBSD.org>
> > AuthorDate: 2024-08-23 16:45:58 +0000
> > Commit:     Stefan Eßer <se@FreeBSD.org>
> > CommitDate: 2024-08-26 16:27:29 +0000
> >
> >     vendor/bc: upgrade to version 7.0.0
> >     
> >     This is a production release to fix three bugs, none of which
> >     affects well formed scripts on FreeBSD:
> >     
> >     The first bug is that bc/dc will exit on macOS when the terminal
> >     is resized.
> >     
> >     The second bug is that an array, which should only be a function
> >     parameter, was accepted as part of larger expressions.
> >     
> >     The third bug is that the value stack for dc was cleared on any error.
> >     However, this is not how other dc behave. To bring dc more in line
> >     with other implementations, this behavior was changed. This change is
> >     why this version is a new major version.
> >     
> >     (cherry picked from commit 54d20d67e2af28d948ce2df13feb039fa10900fc)
> >     
> >     MFC after:      3 days
> 
> This commit introduced a regression. Prior to this one could exit bc using 
> the EOF character defined by stty(1), default ^D. Now one needs to enter 
> the word quit instead of ^D.

Reverting 

https://git.gavinhoward.com/gavin/bc/commit/56bb18255a24b60f785560ab882447d9c959bd93

seems to resolve the issue.

diff --git a/contrib/bc/src/history.c b/contrib/bc/src/history.c
index 6ae9785d9a79..71afe62db879 100644
--- a/contrib/bc/src/history.c
+++ b/contrib/bc/src/history.c
@@ -264,7 +264,7 @@ bc_history_line(BcHistory* h, BcVec* vec, const char* prompt)
        errno = EINTR;
 
        // Get the line.
-       while (line == NULL && (len == -1 || errno == EINTR))
+       while (line == NULL && len == -1 && errno == EINTR)
        {
                line = el_gets(h->el, &len);
                bc_history_use_prompt = false;


--
Herbert