Skip to content

IFS=, in setup_suite with --filter-tags #812

@seanhamilton

Description

@seanhamilton
setup_suite() {
  echo -n "$IFS" | hexdump -C
  [ "$IFS" = $' \t\n' -o "$IFS" = '' ]
}
# bats test_tags=x
@test "x" { :; }
$ bats --tap .
1..1
ok 1 x
$ bats --filter-tags x --tap .
1..1
not ok 1 setup_suite
# (from function `setup_suite' in test file ./setup_suite.bash, line 3)
#   `[ "$IFS" = $' \t\n' ]' failed
# 00000000  2c                                                |,|
# 00000001

workaround:

setup_suite() {
    local IFS
    unset IFS
    [ "$IFS" = '' ]
}

likely culprit: https://github.com/bats-core/bats-core/blob/f1f5115e3621e47fc41a32e36450afa95fdb2830/libexec/bats-core/bats-preprocess#L93C14-L93C14

GNU bash, version 5.2.15(1)-release

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: Bash CodeEverything regarding the bash codePriority: HighBroken behavior in specific environments like in parallel mode or only on some operating systemsSize: MediumChanges in the same fileStatus: ConfirmedThe reproducer worked as describedType: Bug

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions