From owner-dev-commits-src-all@freebsd.org Mon Oct 4 08:06:44 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 788A2679463; Mon, 4 Oct 2021 08:06:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HNCwh2mSWz3rK6; Mon, 4 Oct 2021 08:06:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3BAA815A7E; Mon, 4 Oct 2021 08:06:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19486iwM054591; Mon, 4 Oct 2021 08:06:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19486iBG054590; Mon, 4 Oct 2021 08:06:44 GMT (envelope-from git) Date: Mon, 4 Oct 2021 08:06:44 GMT Message-Id: <202110040806.19486iBG054590@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Stefan E=C3=9Fer?= Subject: git: 662087dfd066 - main - vendor/bc: update to upstream version 5.0.2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: se X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 662087dfd0668dee82ed20d00ced662aa3595059 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Oct 2021 08:06:44 -0000 The branch main has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=662087dfd0668dee82ed20d00ced662aa3595059 commit 662087dfd0668dee82ed20d00ced662aa3595059 Author: Stefan Eßer AuthorDate: 2021-09-19 12:41:20 +0000 Commit: Stefan Eßer CommitDate: 2021-10-04 07:37:19 +0000 vendor/bc: update to upstream version 5.0.2 (cherry picked from commit a60ef1802a36f2f2a5611564191440ea1c1e2f17) --- contrib/bc/NEWS.md | 30 ++++++++++++++++++++++++++++++ contrib/bc/include/status.h | 4 ++++ contrib/bc/include/vector.h | 4 ++-- contrib/bc/include/version.h | 2 +- contrib/bc/src/vector.c | 2 +- contrib/bc/tests/all.sh | 3 +++ contrib/bc/tests/bc/timeconst.sh | 6 ++++-- contrib/bc/tests/dc/errors/33.txt | Bin 329 -> 323 bytes contrib/bc/tests/errors.sh | 26 +++----------------------- contrib/bc/tests/history.py | 15 +++++---------- contrib/bc/tests/other.sh | 14 ++++++++------ contrib/bc/tests/read.sh | 4 +++- contrib/bc/tests/script.sh | 4 +++- contrib/bc/tests/stdin.sh | 4 +++- contrib/bc/tests/test.sh | 4 +++- 15 files changed, 73 insertions(+), 49 deletions(-) diff --git a/contrib/bc/NEWS.md b/contrib/bc/NEWS.md index 3b1477cafb26..f35d593b807a 100644 --- a/contrib/bc/NEWS.md +++ b/contrib/bc/NEWS.md @@ -1,5 +1,35 @@ # News +## 5.0.2 + +This is a production release with one fix for a flaky test. If you have not +experienced problems with the test suite, you do ***NOT*** need to upgrade. + +The test was one that tested whether `bc` fails gracefully when it can't +allocate memory. Unfortunately, there are cases when Linux and FreeBSD lie and +pretend to allocate the memory. + +The reason they do this is because a lot of programs don't use all of the memory +they allocate, so those OS's usually get away with it. + +However, this `bc` uses all of the memory it allocates (at least at page +granularity), so when it tries to use the memory, FreeBSD and Linux kill it. + +This only happens sometimes, however. Other times (on my machine), they do, in +fact, refuse the request. + +So I changed the test to not test for that because I think the graceful failure +code won't really change much. + +## 5.0.1 + +This is a production release with two fixes: + +* Fix for the build on Mac OSX. +* Fix for the build on Android. + +Users that do not use those platforms do ***NOT*** need to update. + ## 5.0.0 This is a major production release with several changes: diff --git a/contrib/bc/include/status.h b/contrib/bc/include/status.h index 781248ad4020..662f2b89c04d 100644 --- a/contrib/bc/include/status.h +++ b/contrib/bc/include/status.h @@ -53,6 +53,10 @@ #define DC_ENABLED (1) #endif // DC_ENABLED +#ifndef BC_ENABLE_LIBRARY +#define BC_ENABLE_LIBRARY (0) +#endif // BC_ENABLE_LIBRARY + // This is error checking for fuzz builds. #if BC_ENABLE_AFL #ifndef __AFL_HAVE_MANUAL_CONTROL diff --git a/contrib/bc/include/vector.h b/contrib/bc/include/vector.h index 8f7cbbcc2b50..c35d22c9eff7 100644 --- a/contrib/bc/include/vector.h +++ b/contrib/bc/include/vector.h @@ -441,7 +441,7 @@ void bc_slabvec_print(BcVec *v, const char *func); * contain @a s. * @param s The source string. */ -#define strcpy(d, l, s) strcpy(d, s) +#define bc_strcpy(d, l, s) strcpy(d, s) #else // _WIN32 @@ -452,7 +452,7 @@ void bc_slabvec_print(BcVec *v, const char *func); * contain @a s. * @param s The source string. */ -#define strcpy(d, l, s) strcpy_s(d, l, s) +#define bc_strcpy(d, l, s) strcpy_s(d, l, s) #endif // _WIN32 diff --git a/contrib/bc/include/version.h b/contrib/bc/include/version.h index 5127c28e2b4a..071b123cccf1 100644 --- a/contrib/bc/include/version.h +++ b/contrib/bc/include/version.h @@ -37,6 +37,6 @@ #define BC_VERSION_H /// The current version. -#define VERSION 5.0.0 +#define VERSION 5.0.2 #endif // BC_VERSION_H diff --git a/contrib/bc/src/vector.c b/contrib/bc/src/vector.c index 1cd90f729956..ebc2e76ca8c8 100644 --- a/contrib/bc/src/vector.c +++ b/contrib/bc/src/vector.c @@ -461,7 +461,7 @@ static char* bc_slab_add(BcSlab *s, const char *str, size_t len) { ptr = (char*) (s->s + s->len); - strcpy(ptr, len, str); + bc_strcpy(ptr, len, str); s->len += len; diff --git a/contrib/bc/tests/all.sh b/contrib/bc/tests/all.sh index 04afdb391d0e..a4a9c8bc8936 100755 --- a/contrib/bc/tests/all.sh +++ b/contrib/bc/tests/all.sh @@ -129,6 +129,9 @@ sh "$testdir/errors.sh" "$d" "$exe" "$@" # Other tests. sh "$testdir/other.sh" "$d" "$extra" "$exe" "$@" +# History tests. +sh "$testdir/history.sh" "$d" -a + printf '\nAll %s tests passed.\n' "$d" printf '\n%s\n' "$stars" diff --git a/contrib/bc/tests/bc/timeconst.sh b/contrib/bc/tests/bc/timeconst.sh index 5c5ec3806ab8..45e10c77bdf4 100755 --- a/contrib/bc/tests/bc/timeconst.sh +++ b/contrib/bc/tests/bc/timeconst.sh @@ -32,6 +32,8 @@ script="$0" testdir=$(dirname "$script") +outputdir=${BC_TEST_OUTPUT_DIR:-$testdir/..} + # Gets the timeconst script, which could be a command-line argument. if [ "$#" -gt 0 ]; then timeconst="$1" @@ -49,8 +51,8 @@ else fi # -out1="$testdir/bc_outputs/bc_timeconst.txt" -out2="$testdir/bc_outputs/bc_timeconst_results.txt" +out1="$outputdir/bc_outputs/bc_timeconst.txt" +out2="$outputdir/bc_outputs/bc_timeconst_results.txt" outdir=$(dirname "$out1") diff --git a/contrib/bc/tests/dc/errors/33.txt b/contrib/bc/tests/dc/errors/33.txt index 524b548e6f4d..7d01c535c665 100644 Binary files a/contrib/bc/tests/dc/errors/33.txt and b/contrib/bc/tests/dc/errors/33.txt differ diff --git a/contrib/bc/tests/errors.sh b/contrib/bc/tests/errors.sh index d6c120aab4e7..c8c82cfe356f 100755 --- a/contrib/bc/tests/errors.sh +++ b/contrib/bc/tests/errors.sh @@ -34,6 +34,8 @@ testdir=$(dirname "$script") . "$testdir/../scripts/functions.sh" +outputdir=${BC_TEST_OUTPUT_DIR:-$testdir} + # Command-line processing. if [ "$#" -eq 0 ]; then printf 'usage: %s dir [exec args...]\n' "$script" @@ -56,7 +58,7 @@ unset BC_LINE_LENGTH unset DC_ENV_ARGS unset DC_LINE_LENGTH -out="$testdir/${d}_outputs/errors_results.txt" +out="$outputdir/${d}_outputs/errors_results.txt" outdir=$(dirname "$out") # Make sure the directory exists. @@ -146,33 +148,11 @@ for testfile in $testdir/$d/*errors.txt; do done -# I need to skip a test here on FreeBSD. -os=$(uname) - -# The list of files we need to skip. -skip_files=" -33.txt -" - # Test all the files in the errors directory. While the loop above does one test # for every line, this does one test per file, but it runs the file through # stdin and as a file on the command-line. for testfile in $testdir/$d/errors/*.txt; do - # If we are on FreeBSD... - if [ "$os" = "FreeBSD" ] && [ "$d" = "dc" ]; then - - b=$(basename "$testfile") - - # If the file is one of the skip files... - if [ -z "${skip_files##*$b*}" ]; then - - printf 'On FreeBSD; skipping %s...\n' "$testfile" - continue - - fi - fi - printf 'Running %s error file %s...' "$d" "$testfile" printf '%s\n' "$halt" | "$exe" "$@" $opts "$testfile" 2> "$out" > /dev/null diff --git a/contrib/bc/tests/history.py b/contrib/bc/tests/history.py index ae25c7cf2854..fff531652b1b 100755 --- a/contrib/bc/tests/history.py +++ b/contrib/bc/tests/history.py @@ -41,6 +41,11 @@ except ImportError: script = sys.argv[0] testdir = os.path.dirname(script) +if "BC_TEST_OUTPUT_DIR" in os.environ: + outputdir = os.environ["BC_TEST_OUTPUT_DIR"] +else: + outputdir = testdir + prompt = ">>> " # This array is for escaping characters that are necessary to escape when @@ -67,16 +72,6 @@ utf8_stress_strs = [ ] -def spawn(exe, args, env, encoding=None, codec_errors='strict'): - if do_test: - f = open(testdir + "/" + exedir + "_outputs/history_test.txt", "wb") - return pexpect.popen_spawn.PopenSpawn([ exe ] + args, env=env, - encoding=encoding, codec_errors=codec_errors, stderr=f) - else: - return pexpect.spawn(exe, args, env=env, encoding=encoding, - codec_errors=codec_errors) - - # Check that the child output the expected line. If history is false, then # the output should change. def check_line(child, expected, prompt=">>> ", history=True): diff --git a/contrib/bc/tests/other.sh b/contrib/bc/tests/other.sh index 0a856f4a6e22..4a26582457e3 100755 --- a/contrib/bc/tests/other.sh +++ b/contrib/bc/tests/other.sh @@ -34,6 +34,8 @@ testdir=$(dirname "$script") . "$testdir/../scripts/functions.sh" +outputdir=${BC_TEST_OUTPUT_DIR:-$testdir} + # Command-line processing. if [ "$#" -ge 2 ]; then @@ -135,8 +137,8 @@ if [ "$d" = "bc" ]; then unset BC_ENV_ARGS - redefine_res="$testdir/bc_outputs/redefine.txt" - redefine_out="$testdir/bc_outputs/redefine_results.txt" + redefine_res="$outputdir/bc_outputs/redefine.txt" + redefine_out="$outputdir/bc_outputs/redefine_results.txt" outdir=$(dirname "$easter_out") @@ -201,8 +203,8 @@ else printf 'Running dc Easter script...' - easter_res="$testdir/dc_outputs/easter.txt" - easter_out="$testdir/dc_outputs/easter_results.txt" + easter_res="$outputdir/dc_outputs/easter.txt" + easter_out="$outputdir/dc_outputs/easter_results.txt" outdir=$(dirname "$easter_out") @@ -222,8 +224,8 @@ else fi -out1="$testdir/../.log_$d.txt" -out2="$testdir/../.log_${d}_test.txt" +out1="$outputdir/${d}_outputs/${d}_other.txt" +out2="$outputdir/${d}_outputs/${d}_other_test.txt" printf 'Running %s line length tests...' "$d" diff --git a/contrib/bc/tests/read.sh b/contrib/bc/tests/read.sh index 1186a19c99bd..a1915eb271ac 100755 --- a/contrib/bc/tests/read.sh +++ b/contrib/bc/tests/read.sh @@ -34,6 +34,8 @@ testdir=$(dirname "$script") . "$testdir/../scripts/functions.sh" +outputdir=${BC_TEST_OUTPUT_DIR:-$testdir} + # Command-line processing. if [ "$#" -lt 1 ]; then printf 'usage: %s dir [exe [args...]]\n' "$0" @@ -58,7 +60,7 @@ name="$testdir/$d/read.txt" results="$testdir/$d/read_results.txt" errors="$testdir/$d/read_errors.txt" -out="$testdir/${d}_outputs/read_results.txt" +out="$outputdir/${d}_outputs/read_results.txt" outdir=$(dirname "$out") # Make sure the directory exists. diff --git a/contrib/bc/tests/script.sh b/contrib/bc/tests/script.sh index f8fdd67ee137..162437af8f22 100755 --- a/contrib/bc/tests/script.sh +++ b/contrib/bc/tests/script.sh @@ -35,6 +35,8 @@ testdir=$(dirname "${script}") . "$testdir/../scripts/functions.sh" +outputdir=${BC_TEST_OUTPUT_DIR:-$testdir} + # Command-line processing. if [ "$#" -lt 2 ]; then printf 'usage: %s dir script [run_extra_tests] [run_stack_tests] [generate_tests] [time_tests] [exec args...]\n' "$script" @@ -126,7 +128,7 @@ if [ "$run_stack_tests" -eq 0 ]; then fi -out="$testdir/${d}_outputs/${name}_script_results.txt" +out="$outputdir/${d}_outputs/${name}_script_results.txt" outdir=$(dirname "$out") # Make sure the directory exists. diff --git a/contrib/bc/tests/stdin.sh b/contrib/bc/tests/stdin.sh index 56bd1aae227b..c9e02253c30a 100755 --- a/contrib/bc/tests/stdin.sh +++ b/contrib/bc/tests/stdin.sh @@ -35,6 +35,8 @@ testdir=$(dirname "$script") . "$testdir/../scripts/functions.sh" +outputdir=${BC_TEST_OUTPUT_DIR:-$testdir} + # Command-line processing. if [ "$#" -lt 1 ]; then printf 'usage: %s dir [exe [args...]]\n' "$0" @@ -55,7 +57,7 @@ else exe="$testdir/../bin/$d" fi -out="$testdir/${d}_outputs/stdin_results.txt" +out="$outputdir/${d}_outputs/stdin_results.txt" outdir=$(dirname "$out") # Make sure the directory exists. diff --git a/contrib/bc/tests/test.sh b/contrib/bc/tests/test.sh index ec7f6ba920c9..9d557a715dc0 100755 --- a/contrib/bc/tests/test.sh +++ b/contrib/bc/tests/test.sh @@ -35,6 +35,8 @@ testdir=$(dirname "$script") . "$testdir/../scripts/functions.sh" +outputdir=${BC_TEST_OUTPUT_DIR:-$testdir} + # Command-line processing. if [ "$#" -lt 2 ]; then printf 'usage: %s dir test [generate_tests] [time_tests] [exe [args...]]\n' "$0" @@ -74,7 +76,7 @@ else exe="$testdir/../bin/$d" fi -out="$testdir/${d}_outputs/${t}_results.txt" +out="$outputdir/${d}_outputs/${t}_results.txt" outdir=$(dirname "$out") # Make sure the directory exists.