Skip to content

Fix run-tests.sh silently truncating recursive ** glob buckets#14700

Merged
cderv merged 4 commits into
mainfrom
fix/bash-run-tests-sh-silently-truncates-recursive
Jul 16, 2026
Merged

Fix run-tests.sh silently truncating recursive ** glob buckets#14700
cderv merged 4 commits into
mainfrom
fix/bash-run-tests-sh-silently-truncates-recursive

Conversation

@cderv

@cderv cderv commented Jul 16, 2026

Copy link
Copy Markdown
Member

On Linux and macOS CI, a ** glob bucket passed to run-tests.sh (e.g. qmd-files/**/*.qmd from the feature-format matrix job) only picks up files exactly one directory level deep, silently dropping anything nested further. The ff-matrix job ran 10 tests on ubuntu-latest against 271 on windows-latest for the identical bucket.

Root Cause

run-tests.sh builds its resolved file list and passes it unquoted to the final deno test invocation. Bash then glob-expands that list itself, and without globstar enabled, ** behaves like a single *, matching only one directory level.

A prior fix added shopt -s globstar to the CI wrapper around the run-tests.sh call (9d718d1). That only affects the wrapper step's own shell, though - run-tests.sh runs as a separate bash process with its own default shell-option state, so the setting never reached the actual expansion and the fix was a no-op.

Fix

Convert the resolved file list to a bash array and quote it at the deno invocation, so bash never touches the pattern. A literal, unexpanded glob string now reaches smoke-all.test.ts, which already expands it itself via expandGlobSync - the same mechanism Windows already relies on, since PowerShell never shell-expands the pattern either. Also removes the now-dead shopt -s globstar from the CI wrapper.

Adds a standalone regression test (tests/run-tests-recursive-glob.test.sh) that runs the real run-tests.sh against a nested fixture with a stubbed deno binary, confirming a file two directories deep survives a ** bucket.

Bash only expands ** recursively when globstar is enabled, and run-tests.sh
passed its resolved TESTS_TO_RUN unquoted to the final deno invocation,
letting bash glob-expand it with globstar off. A bucket like
qmd-files/**/*.qmd matched only files exactly one directory level deep,
silently dropping anything nested further - which is why the ff-matrix
CI job ran 10 tests on ubuntu-latest against 271 on windows-latest for the
same bucket (run-tests.ps1 never shell-expands the pattern, deferring to
Deno's own recursive glob support in smoke-all.test.ts).

A prior attempt to fix this (9d718d1) added `shopt -s globstar` to the
CI wrapper around the run-tests.sh call, but that only affects the wrapper
step's own shell - run-tests.sh runs as a separate bash process with its
own default shell-option state, so the setting never reached the actual
expansion.

Convert TESTS_TO_RUN and SMOKE_ALL_FILES to bash arrays and quote them at
the deno invocation so bash never expands the pattern itself; a literal
glob string now reaches smoke-all.test.ts's own expandGlobSync, matching
the working Windows code path instead of relying on a second, divergent
glob engine. Also drops the now-dead `shopt -s globstar` from the CI
wrapper.

Adds tests/run-tests-recursive-glob.test.sh, a standalone regression test
that runs the real run-tests.sh against a nested qmd fixture with a
recorder-stub deno binary, confirming a depth-2 file survives a **
bucket.
@posit-snyk-bot

posit-snyk-bot commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

cderv added 3 commits July 16, 2026 18:12
Running the full qmd-files tree locally (as now happens in CI after the
run-tests.sh recursive-glob fix) leaves keep-typ and ipynb-cache
byproducts untracked and unignored.
Georgia is a Windows/macOS-bundled font absent on Ubuntu CI runners.
Typst CSS font-family filtering (#12556) silently drops unavailable
fonts, so the same document rendered `("Georgia", "serif")` on
Windows/macOS but `("serif",)` on Ubuntu. This went unnoticed because
the fixture never actually ran in CI until the run-tests.sh recursive
glob fix. Libertinus Serif ships embedded in the Typst binary, so it
is present on every host regardless of installed system fonts.
…v token

The multi-file loop in run-tests.sh iterated `"$*"` (all positional args
joined into one string) instead of `"$@"`, so passing several .test.ts or
.qmd files at once - documented in tests/README.md - only ever produced a
single glued token. Quoting TESTS_TO_RUN as an array (acc33e7) removed the
accidental unquoted word-splitting that used to reconstruct the separate
args, exposing the bug as a real regression.
@cderv cderv merged commit 9d3e107 into main Jul 16, 2026
51 checks passed
@cderv cderv deleted the fix/bash-run-tests-sh-silently-truncates-recursive branch July 16, 2026 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants