Skip to content

test failed with bash 5.3 #83

Closed
Closed

Description

@qaqland

Error Message:

$ BATS_LIB_PATH=/usr/lib/bats bats test/assert_output.bats

 ✗ assert_output() --regexp <regexp>: returns 1 and displays an error message if <regexp> is not a valid extended regular expression
   (from function `assert_test_fail' in file test/test_helper.bash, line 28,
    in test file test/assert_output.bats, line 257)
     `assert_test_fail <<'ERR_MSG'' failed

Check the error message and find that one extra line is in output, it is from bash 5.3

// before
	  result = sh_regmatch (arg1, arg2, mflags);

// after
	  errstr = NULL;
	  result = sh_regmatch (arg1, arg2, mflags, &errstr);
	  if (result == 2)
	    {
	      if (errstr && *errstr)
		builtin_error (_("invalid regular expression `%s': %s"), arg2, errstr);
	      else
		builtin_error (_("invalid regular expression `%s'"), arg2);
	      free (errstr);
	    }

https://github.com/bminor/bash/commit/b8c60bc9ca365f8261fa97900b6fa939f6ebc303

so it is easy to reproduce this case:

$ [[ '' =~ [.* ]]
bash: [[: invalid regular expression `[.*': Missing ']'

$ bash --version
GNU bash, version 5.3.3(1)-release (x86_64-alpine-linux-musl)

Activity

  1. gioele commented on Sep 5, 2025

    @gioele

    For the record, this is affecting Debian unstable/testing (that now uses Bash 5.3): https://bugs.debian.org/1114061.

  2. martin-schulze-vireso commented on Oct 11, 2025

    @martin-schulze-vireso
    Member

    Closed by #84 , fixed in v2.2.1 (just released).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions