Repository navigation
fix(_common): export KEY=value in toolkit.env sets KEY, not exportKEY (#579) - #609
Merged
Merged
Conversation
…#579) mxtk_load_env (project-bin/_common.sh:165) built the key with tr -d '[:space:]' over everything left of '=', so 'export MENDIX_APP=/x' exported 'exportMENDIX_APP' and MENDIX_APP stayed unset, though the comment two lines below says the export form works. A leading 'export<ws>' is now dropped first (pure bash, bash 3.2 safe, no new subprocess). Also: the quote strip ran before the whitespace trim, so 'KEY = "v"' kept its quotes; the trim now runs first. Fixture tests/wave2/test-common-windows.sh case 4b: fails against master's _common.sh (10 passed, 1 failed), passes with the fix (11 passed, 0 failed). Part of #579 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018LeNWZV2sVH62vkgfYh5u5
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.
Part of #579
Root cause
project-bin/_common.sh:165(mxtk_load_env, on master):This removes all whitespace from everything left of
=. Soexport MENDIX_APP=/xbecomes the keyexportMENDIX_APP. That key passes the name checks and is exported, andMENDIX_APPstays unset. The comment at l.169 says "export KEY=value ... work". Note: the file isproject-bin/_common.sh. There is nobin/_common.sh.A second defect sits in the same lines (l.170-171): the quote strip ran before the whitespace trim. So
KEY = "value"kept its quotes, because the value started with a space.Fix
export<whitespace>from the key before the existingtr. This is pure bash parameter expansion plus acase, so it works on bash 3.2 and Git Bash and adds no process per line (see exec: ~60% fewer process starts per exec (Windows overhead, #584/#585) #590).exportX=1is still the keyexportX.Evidence
Reproduced in a scratch project, sourcing master's
_common.shwith atoolkit.envofexport MENDIX_APP=/x/y,export MXCLI_VERSION="0.29.0",PYTHON = "/usr/bin/py":Fixture
New case 4b in
tests/wave2/test-common-windows.sh, the existingmxtk_load_envfixture.Against master's file (
git show origin/master:project-bin/_common.sh), exit 1:Here
MENDIX_APPfell through to the user file,MXCLI_VERSIONwas empty, the quotes were kept, andexportMENDIX_APPwas set.Against this branch, exit 0:
Only this fixture was run. The full suites were not.
Regression notes
KEY=valueline parses exactly as before.exportKEYvariable now setsKEY. Precedence is unchanged: an environment variable that is already set still wins.toolkit.env. The evidence is the scratch reproduction and the fixture above.CHANGELOG line under
## Unreleased, same commit.Review: pending independent review
Generated by Claude Code