Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package bats for openSUSE:Factory checked in 
at 2022-06-09 14:11:50
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/bats (Old)
 and      /work/SRC/openSUSE:Factory/.bats.new.1548 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "bats"

Thu Jun  9 14:11:50 2022 rev:13 rq:981380 version:1.6.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/bats/bats.changes        2022-04-19 
09:58:40.947596867 +0200
+++ /work/SRC/openSUSE:Factory/.bats.new.1548/bats.changes      2022-06-09 
14:11:57.644541546 +0200
@@ -1,0 +2,13 @@
+Wed Jun  8 19:11:07 UTC 2022 - Olav Reinert <seroto...@gmail.com>
+
+- Update to version 1.6.1:
+  * prevent teardown, teardown_file, and teardown_suite from overriding bats'
+    exit code by setting $status (e.g. via calling run) (#581, #575)
+    - CRITICAL: this can return exit code 0 despite failed tests, thus
+      preventing your CI from reporting test failures! The regression happened
+      in version 1.6.0.
+  * corrected invalid documentation of run -N (had =N instead) (#579)
+    - CRITICAL: using the incorrect form can lead to silent errors. See issue
+      #578 for more details and how to find out if your tests are affected.
+
+-------------------------------------------------------------------

Old:
----
  bats-core-1.6.0.tar.gz

New:
----
  bats-core-1.6.1.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ bats.spec ++++++
--- /var/tmp/diff_new_pack.VaFDuC/_old  2022-06-09 14:11:58.184542269 +0200
+++ /var/tmp/diff_new_pack.VaFDuC/_new  2022-06-09 14:11:58.192542280 +0200
@@ -18,7 +18,7 @@
 
 %define pname %{name}-core
 Name:           bats
-Version:        1.6.0
+Version:        1.6.1
 Release:        0
 Summary:        Bash Automated Testing System
 License:        MIT

++++++ bats-core-1.6.0.tar.gz -> bats-core-1.6.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bats-core-1.6.0/contrib/rpm/bats.spec 
new/bats-core-1.6.1/contrib/rpm/bats.spec
--- old/bats-core-1.6.0/contrib/rpm/bats.spec   2022-02-24 15:27:24.000000000 
+0100
+++ new/bats-core-1.6.1/contrib/rpm/bats.spec   2022-05-14 00:20:21.000000000 
+0200
@@ -3,7 +3,7 @@
 %global repo            bats-core
 
 Name:           bats
-Version:        1.6.0
+Version:        1.6.1
 Release:        1%{?dist}
 Summary:        Bash Automated Testing System
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bats-core-1.6.0/docs/CHANGELOG.md 
new/bats-core-1.6.1/docs/CHANGELOG.md
--- old/bats-core-1.6.0/docs/CHANGELOG.md       2022-02-24 15:27:24.000000000 
+0100
+++ new/bats-core-1.6.1/docs/CHANGELOG.md       2022-05-14 00:20:21.000000000 
+0200
@@ -8,7 +8,21 @@
 [kac]: https://keepachangelog.com/en/1.0.0/
 [semver]: https://semver.org/
 
-## [Unreleased]
+## [1.6.1] - 2022-05-14
+
+### Fixed
+
+* prevent `teardown`, `teardown_file`, and `teardown_suite` from overriding 
bats'
+  exit code by setting `$status` (e.g. via calling `run`) (#581, #575)
+  * **CRITICAL**: this can return exit code 0 despite failed tests, thus 
preventing
+    your CI from reporting test failures! The regression happened in version 
1.6.0.
+
+#### Documentation
+
+* corrected invalid documentation of `run -N` (had `=N` instead) (#579)
+  * **CRITICAL**: using the incorrect form can lead to silent errors. See
+    [issue #578](https://github.com/bats-core/bats-core/issues/578) for more
+    details and how to find out if your tests are affected.
 
 ## [1.6.0] - 2022-02-24
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bats-core-1.6.0/docs/source/writing-tests.md 
new/bats-core-1.6.1/docs/source/writing-tests.md
--- old/bats-core-1.6.0/docs/source/writing-tests.md    2022-02-24 
15:27:24.000000000 +0100
+++ new/bats-core-1.6.1/docs/source/writing-tests.md    2022-05-14 
00:20:21.000000000 +0200
@@ -58,8 +58,13 @@
 If invoked with one of the following as the first argument, `run`
 will perform an implicit check on the exit status of the invoked command:
 
+> ?????? **_CAUTION_** ??????: Previous versions of this documentation 
erronously contained
+> the syntax `=N` instead of `-N` below. Using this wrong format leads to 
silent
+> errors. See [issue #578](https://github.com/bats-core/bats-core/issues/578)
+> for more details and how to found out if your tests are affected.
+
 ```pre
-    =N  expect exit status N (0-255), fail if otherwise
+    -N  expect exit status N (0-255), fail if otherwise
     ! expect nonzero exit status (1-255), fail if command succeeds
 ```
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bats-core-1.6.0/libexec/bats-core/bats 
new/bats-core-1.6.1/libexec/bats-core/bats
--- old/bats-core-1.6.0/libexec/bats-core/bats  2022-02-24 15:27:24.000000000 
+0100
+++ new/bats-core-1.6.1/libexec/bats-core/bats  2022-05-14 00:20:21.000000000 
+0200
@@ -1,7 +1,7 @@
 #!/usr/bin/env bash
 set -e
 
-export BATS_VERSION='1.6.0'
+export BATS_VERSION='1.6.1'
 VALID_FORMATTERS="pretty, junit, tap, tap13"
 
 version() {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bats-core-1.6.0/libexec/bats-core/bats-exec-file 
new/bats-core-1.6.1/libexec/bats-core/bats-exec-file
--- old/bats-core-1.6.0/libexec/bats-core/bats-exec-file        2022-02-24 
15:27:24.000000000 +0100
+++ new/bats-core-1.6.1/libexec/bats-core/bats-exec-file        2022-05-14 
00:20:21.000000000 +0200
@@ -118,7 +118,6 @@
 
 bats_file_teardown_trap() {
   bats_run_teardown_file
-  local status=0
   bats_file_exit_trap
 }
 
@@ -144,9 +143,9 @@
     bats_print_failed_command "${stack_trace[@]}" >&3
     bats_prefix_lines_for_tap_output < "$BATS_OUT" | bats_replace_filename >&3
     rm -rf "$BATS_OUT"
-    status=1
+    bats_exec_file_status=1
   fi
-  exit $status
+  exit $bats_exec_file_status
 }
 
 function setup_file() {
@@ -250,15 +249,15 @@
 }
 
 bats_run_tests() {
-  status=0
+  bats_exec_file_status=0
 
   if [[ "$num_jobs" != 1 && "${BATS_NO_PARALLELIZE_WITHIN_FILE-False}" == 
False ]]; then
     export BATS_SEMAPHORE_NUMBER_OF_SLOTS="$num_jobs"
-    bats_run_tests_in_parallel "$BATS_RUN_TMPDIR/parallel_output" || status=1
+    bats_run_tests_in_parallel "$BATS_RUN_TMPDIR/parallel_output" || 
bats_exec_file_status=1
   else
     for test_name in "${tests_to_run[@]}"; do
       if [[ "${BATS_INTERRUPTED-NOTSET}" != NOTSET ]]; then
-        status=130 # bash's code for SIGINT exits
+        bats_exec_file_status=130 # bash's code for SIGINT exits
         break
       fi
       # Only handle non-empty lines
@@ -267,14 +266,13 @@
         ((++test_number_in_file))
         # deal with empty flags to avoid spurious "unbound variable" errors on 
Bash 4.3 and lower
         if [[ "${#flags[@]}" -gt 0 ]]; then
-          "$BATS_LIBEXEC/bats-exec-test" "${flags[@]}" "$filename" 
"$test_name" "$test_number_in_suite" "$test_number_in_file" || status=1
+          "$BATS_LIBEXEC/bats-exec-test" "${flags[@]}" "$filename" 
"$test_name" "$test_number_in_suite" "$test_number_in_file" || 
bats_exec_file_status=1
         else
-          "$BATS_LIBEXEC/bats-exec-test" "$filename" "$test_name" 
"$test_number_in_suite" "$test_number_in_file" || status=1
+          "$BATS_LIBEXEC/bats-exec-test" "$filename" "$test_name" 
"$test_number_in_suite" "$test_number_in_file" || bats_exec_file_status=1
         fi
       fi
     done
   fi
-  export status
 }
 
 bats_create_file_tempdirs() {
@@ -322,4 +320,4 @@
 trap bats_interrupt_trap INT
 bats_run_teardown_file
 
-exit $status
+exit $bats_exec_file_status
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bats-core-1.6.0/libexec/bats-core/bats-exec-suite 
new/bats-core-1.6.1/libexec/bats-core/bats-exec-suite
--- old/bats-core-1.6.0/libexec/bats-core/bats-exec-suite       2022-02-24 
15:27:24.000000000 +0100
+++ new/bats-core-1.6.1/libexec/bats-core/bats-exec-suite       2022-05-14 
00:20:21.000000000 +0200
@@ -135,10 +135,10 @@
   if [[ ${BATS_INTERRUPTED-NOTSET} != NOTSET ]]; then
     printf "\n# Received SIGINT, aborting ...\n\n"
   fi
-  exit "$status"
+  exit "$bats_exec_suite_status"
 }
 
-status=0
+bats_exec_suite_status=0
 printf '1..%d\n' "${test_count}"
 
 # No point on continuing if there's no tests.
@@ -163,15 +163,15 @@
   # shellcheck disable=SC2086,SC2068
   # we need to handle the quoting of ${flags[@]} ourselves,
   # because parallel can only quote it as one
-  parallel --keep-order --jobs "$num_jobs" bats-exec-file "$(printf "%q " 
"${flags[@]}")" "{}" "$TESTS_LIST_FILE"  ::: "${BATS_UNIQUE_TEST_FILENAMES[@]}" 
2>&1 || status=1
+  parallel --keep-order --jobs "$num_jobs" bats-exec-file "$(printf "%q " 
"${flags[@]}")" "{}" "$TESTS_LIST_FILE"  ::: "${BATS_UNIQUE_TEST_FILENAMES[@]}" 
2>&1 || bats_exec_suite_status=1
 else
   for filename in "${BATS_UNIQUE_TEST_FILENAMES[@]}"; do
     if [[ "${BATS_INTERRUPTED-NOTSET}" != NOTSET ]]; then
-      status=130 # bash's code for SIGINT exits
+      bats_exec_suite_status=130 # bash's code for SIGINT exits
       break
     fi
-    bats-exec-file "${flags[@]}" "$filename" "${TESTS_LIST_FILE}" || status=1
+    bats-exec-file "${flags[@]}" "$filename" "${TESTS_LIST_FILE}" || 
bats_exec_suite_status=1
   done
 fi
 
-exit "$status"
+exit "$bats_exec_suite_status"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bats-core-1.6.0/libexec/bats-core/bats-exec-test 
new/bats-core-1.6.1/libexec/bats-core/bats-exec-test
--- old/bats-core-1.6.0/libexec/bats-core/bats-exec-test        2022-02-24 
15:27:24.000000000 +0100
+++ new/bats-core-1.6.1/libexec/bats-core/bats-exec-test        2022-05-14 
00:20:21.000000000 +0200
@@ -94,18 +94,18 @@
 
 bats_teardown_trap() {
   bats_check_status_from_trap
-  local status=0
+  local bats_teardown_trap_status=0
   # mark the start of this function to distinguish where skip is called
   # parameter 1 will signify the reason why this function was called
   # this is used to identify when this is called as exit trap function
   BATS_TEARDOWN_STARTED=${1:-1}
-  teardown >>"$BATS_OUT" 2>&1 || status="$?"
+  teardown >>"$BATS_OUT" 2>&1 || bats_teardown_trap_status="$?"
 
-  if [[ $status -eq 0 ]]; then
+  if [[ $bats_teardown_trap_status -eq 0 ]]; then
     BATS_TEARDOWN_COMPLETED=1
   elif [[ -n "$BATS_TEST_COMPLETED" ]]; then
     BATS_DEBUG_LAST_STACK_TRACE_IS_VALID=1
-    BATS_ERROR_STATUS="$status"
+    BATS_ERROR_STATUS="$bats_teardown_trap_status"
   fi
 
   bats_exit_trap
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bats-core-1.6.0/package.json 
new/bats-core-1.6.1/package.json
--- old/bats-core-1.6.0/package.json    2022-02-24 15:27:24.000000000 +0100
+++ new/bats-core-1.6.1/package.json    2022-05-14 00:20:21.000000000 +0200
@@ -1,6 +1,6 @@
 {
   "name": "bats",
-  "version": "1.6.0",
+  "version": "1.6.1",
   "description": "Bash Automated Testing System",
   "homepage": "https://github.com/bats-core/bats-core#readme";,
   "license": "MIT",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bats-core-1.6.0/test/bats.bats 
new/bats-core-1.6.1/test/bats.bats
--- old/bats-core-1.6.0/test/bats.bats  2022-02-24 15:27:24.000000000 +0100
+++ new/bats-core-1.6.1/test/bats.bats  2022-05-14 00:20:21.000000000 +0200
@@ -1259,3 +1259,19 @@
     [[ $FDS_LOG == *'otherfunc fds after: (0 1 2)'* ]] || false
     [[ $FDS_LOG == *'setup_file fds after: (0 1 2)'* ]] || false
 }
+
+@test "Setting status in teardown* does not override exit code (see issue 
#575)" {
+  TEARDOWN_RETURN_CODE=0 TEST_RETURN_CODE=0 STATUS=0 run -0 bats 
"$FIXTURE_ROOT/teardown_override_status.bats"
+  TEARDOWN_RETURN_CODE=1 TEST_RETURN_CODE=0 STATUS=0 run -1 bats 
"$FIXTURE_ROOT/teardown_override_status.bats"
+  TEARDOWN_RETURN_CODE=0 TEST_RETURN_CODE=1 STATUS=0 run -1 bats 
"$FIXTURE_ROOT/teardown_override_status.bats"
+  TEARDOWN_RETURN_CODE=1 TEST_RETURN_CODE=1 STATUS=0 run -1 bats 
"$FIXTURE_ROOT/teardown_override_status.bats"
+  TEARDOWN_RETURN_CODE=0 TEST_RETURN_CODE=0 STATUS=1 run -0 bats 
"$FIXTURE_ROOT/teardown_override_status.bats"
+  TEARDOWN_RETURN_CODE=1 TEST_RETURN_CODE=0 STATUS=1 run -1 bats 
"$FIXTURE_ROOT/teardown_override_status.bats"
+
+  TEARDOWN_RETURN_CODE=0 TEST_RETURN_CODE=0 STATUS=0 run -0 bats 
"$FIXTURE_ROOT/teardown_file_override_status.bats"
+  TEARDOWN_RETURN_CODE=1 TEST_RETURN_CODE=0 STATUS=0 run -1 bats 
"$FIXTURE_ROOT/teardown_file_override_status.bats"
+  TEARDOWN_RETURN_CODE=0 TEST_RETURN_CODE=1 STATUS=0 run -1 bats 
"$FIXTURE_ROOT/teardown_file_override_status.bats"
+  TEARDOWN_RETURN_CODE=1 TEST_RETURN_CODE=1 STATUS=0 run -1 bats 
"$FIXTURE_ROOT/teardown_file_override_status.bats"
+  TEARDOWN_RETURN_CODE=0 TEST_RETURN_CODE=0 STATUS=1 run -0 bats 
"$FIXTURE_ROOT/teardown_file_override_status.bats"
+  TEARDOWN_RETURN_CODE=1 TEST_RETURN_CODE=0 STATUS=1 run -1 bats 
"$FIXTURE_ROOT/teardown_file_override_status.bats"
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/bats-core-1.6.0/test/fixtures/bats/teardown_file_override_status.bats 
new/bats-core-1.6.1/test/fixtures/bats/teardown_file_override_status.bats
--- old/bats-core-1.6.0/test/fixtures/bats/teardown_file_override_status.bats   
1970-01-01 01:00:00.000000000 +0100
+++ new/bats-core-1.6.1/test/fixtures/bats/teardown_file_override_status.bats   
2022-05-14 00:20:21.000000000 +0200
@@ -0,0 +1,9 @@
+teardown_file() {
+    # shellcheck disable=SC2034
+    status=${STATUS?}
+    return "${TEARDOWN_RETURN_CODE?}"
+}
+
+@test "return expected code" {
+    return "${TEST_RETURN_CODE?}"
+}
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/bats-core-1.6.0/test/fixtures/bats/teardown_override_status.bats 
new/bats-core-1.6.1/test/fixtures/bats/teardown_override_status.bats
--- old/bats-core-1.6.0/test/fixtures/bats/teardown_override_status.bats        
1970-01-01 01:00:00.000000000 +0100
+++ new/bats-core-1.6.1/test/fixtures/bats/teardown_override_status.bats        
2022-05-14 00:20:21.000000000 +0200
@@ -0,0 +1,8 @@
+teardown() {
+    status=${STATUS?}
+    return "${TEARDOWN_RETURN_CODE?}"
+}
+
+@test "return expected code" {
+    return "${TEST_RETURN_CODE?}"
+}
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bats-core-1.6.0/test.bats 
new/bats-core-1.6.1/test.bats
--- old/bats-core-1.6.0/test.bats       1970-01-01 01:00:00.000000000 +0100
+++ new/bats-core-1.6.1/test.bats       2022-05-14 00:20:21.000000000 +0200
@@ -0,0 +1,7 @@
+teardown() {
+       false
+}
+
+@test test {
+       false
+}

Reply via email to