Skip to content

Commit ab928cd

Browse files
authored
Merge pull request #1446 from yedayak/1435-workaround-bash-bug
test(filedir): Workaround bug in bash 5.3
2 parents acc4453 + 034d8ef commit ab928cd

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

test/t/unit/test_unit_compgen_filedir.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,21 @@ def test_26(self, bash, functions, funcname):
228228
completion = assert_complete(
229229
bash, r'%s "a\$b/' % funcname, cwd="_filedir"
230230
)
231-
assert completion == 'h"'
231+
try:
232+
assert completion == 'h"'
233+
except AssertionError:
234+
bash_version = assert_bash_exec(
235+
bash,
236+
r'printf "%s.%s\n" "${BASH_VERSINFO[0]}" "${BASH_VERSINFO[1]}"',
237+
want_output=True,
238+
).strip()
239+
# This is workaround for https://github.com/scop/bash-completion/issues/1435, see
240+
# https://lists.gnu.org/archive/html/bug-bash/2025-09/msg00332.html
241+
# Once this is fixed, the version check should be minimized further
242+
if bash_version == "5.3":
243+
assert completion.endswith('h" ')
244+
else:
245+
raise
232246

233247
@pytest.mark.xfail(reason="TODO: non-ASCII issues with test suite?")
234248
@pytest.mark.parametrize("funcname", "f f2".split())

0 commit comments

Comments
 (0)