Remove script-dir push/pop from WASM dofile override#127
Merged
gordonwoodhull merged 1 commit intomainfrom Apr 16, 2026
Merged
Conversation
The WASM dofile override was pushing/popping the script-dir stack around each call, causing resolve_path inside dofile'd scripts to resolve relative to the loaded file's directory. Native Lua's C dofile doesn't do this, nor do Pandoc or TS Quarto. No built-in extension relies on this behavior. Remove the push/pop to align WASM with native, eliminating the behavioral divergence reported in #112. Remove the now-unnecessary test_dofile_script_dir_stack test. Update plan and design docs. Closes #112
67a1c8a to
2542f6f
Compare
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.
Summary
dofileoverride indofile_wasm.rs, making it a pure file I/O shimtest_dofile_script_dir_stacktest that validated the removed behavior2026-04-01-lua-api-quarto-doc.md) and design doc (lua-wasm.md) to reflect the changeContext
The WASM
dofileoverride was pushing/popping the script-dir stack around each call, causingresolve_pathinside dofile'd scripts to resolve relative to the loaded file's directory. Native Lua's Cdofiledoesn't do this, nor do Pandoc or TS Quarto. No built-in extension relies on this behavior — the video extension'sdofilecall passes an already-resolved absolute path.This eliminates the behavioral divergence by aligning WASM with native: option (2) from the issue discussion.
Closes #112
Test plan
cargo nextest run -p pampa— 3700 passed, 2 skippedcargo nextest run --workspace— 7263 passed, 195 skippedcargo build --workspace— clean