Repository navigation
fix(cli): quote the env lines init writes, and point the next run at a custom tests dir - #1424
Merged
Merged
Conversation
…a custom tests dir .env is sourced as shell, so an unquoted BASHUNIT_BOOTSTRAP turned a directory with a space into a command and broke every next run with an error naming a path the user never typed. The value is written double-quoted with the special characters escaped. A custom directory also needs BASHUNIT_DEFAULT_PATH, or the next bare bashunit finds no tests; the shared idempotent write moves into a helper so both lines get the same re-init treatment.
The merge with main dropped the Unreleased Changed entries and reordered the sections. The init reference now shows the quoted BASHUNIT_BOOTSTRAP line and the BASHUNIT_DEFAULT_PATH line written for a custom directory.
Member
|
[Claude] Reviewed and pushed 76c675d. The code change holds: names with a space, |
3 tasks
Chemaclass
approved these changes
Oct 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
bashunit init <dir>writesBASHUNIT_BOOTSTRAP=<dir>/bootstrap.shto.envwithout quotes, and.envis sourced as shell. Afterbashunit init "my tests", the next barebashunitdies with.env: line 1: tests/bootstrap.sh: No such file or directory(Fixes #1411).Root cause
The value is written unquoted at
src/cli/init.sh, so a directory with a space makes the shell read the line as an assignment followed by a command. A custom directory was also invisible to discovery: barebashunitsearchesBASHUNIT_DEFAULT_PATH("tests"), whichinit "my tests"never set.Fix
The env lines are written double-quoted, escaping the characters that are special inside double quotes (
\,",$, backtick), so.envreads them as one assignment. The idempotent write (exact-match skip, comment an older value out, append — #1175) moves into a small helper both lines share. A custom directory additionally writesBASHUNIT_DEFAULT_PATH="<dir>", so the example test runs on the next bare invocation.Testing
New acceptance test
test_bashunit_init_with_a_space_in_the_directory_runs_afterwards(init into a spaced directory, then run bashunit there: no "No such file or directory", "1 passed") fails on the current code and passes with the fix;test_bashunit_init_updates_envnow expects the quoted equivalent. The wholetests/acceptance/bashunit_init_test.sh: 18 passed, 1 pre-existing conditional skip. This machine is Windows (the package declares unix-only,make/shfmtunavailable), so the full-suite gates run in CI; note the branch was pushed through the GitHub REST API because git-over-443 was unreachable from here — the commit content is identical to a local push.