Repository navigation
WIP: fix host external-command channel prefix composition (#1766) - #1779
Merged
Merged
Conversation
…nts instead of re-applying raw values (#1766) GNU variables.c assign_in_env / execute_cmd.c: prefix assignments are applied to the shell table before the command runs, and a compound tempenv word binds as the literal list text; variables.c make_variable_value with ASS_APPEND composes the window value for appends. The host channel loop re-applied every prefix assignment's expanded value into the host env map, so a top-level append overwrote the composed value with the raw RHS (a+=5 showed 5, not 145), a compound word leaked the internal marker (a=__RUBASH_CA1__(x y)), and a pipeline-stage append did the same from the window value — the rubash#1620 root-cause-2 shape on the embedded-host channel. Top-level dispatch (assignments already applied by the dispatch seam): skip appends, inheriting the composed table value, exactly like apply_external_environment. Pipeline-stage dispatch (assignments never reach the table): compose tempenv_scalar_view of the export target plus the marker-stripped RHS, the way the stage spawner does (scalar 145, indexed element 0, assoc appended list; nameref resolves to its target). Both paths strip COMPOUND_ASSIGNMENT_MARKER. The handler contract (FnMut(&[String], &HashMap)) is untouched; tempenv_scalar_view is widened to pub(in crate::executor) for reuse, as the carrier change does. The top-level compound-append value (GNU 1(9)) still rides the carrier table fix (PR #1767); this change pins only the host loop's no-leak duty on that row until then. Fixes #1766
caomengxuan666
marked this pull request as ready for review
October 26, 2026 12:34
caomengxuan666
added a commit
that referenced
this pull request
Oct 27, 2026
…s-only) (#1812) * test(issue1766): forward-port host-env harness drop + upgrade weak compound-append row to exact 1(9) Forward-port of 35e527a (fix9/carrier-host1766), which missed the #1779 merge: drop the Executor before unwrapping the capture Arc in run_host_captures, otherwise all 16 tests panic in try_unwrap before any assertion runs. Also upgrades the formerly weak top-level compound-append row (no-marker-leak only) to assert the exact GNU value 1(9); its upgrade condition is met now that #1767 has merged. The 5 base-clone rows (marker hits on __RUBASH_LAST/CURRENT_COMMAND, nameref contains_key ref) are deliberately left untouched pending the parent's ruling on the host map contract (rescope test invariants vs exported-only host map). Refs #1766 * fix(executor): drop nameref alias cells from the host env map (rubash#1766) Adjudication (c) for the last two PR #1812 pins (issue1766_top/stage_nameref_append_binds_target): the pins are correct GNU expectations - 'declare -n ref=var; var=orig; ref+=x env' prints var=origx and NO ref= line - and the product leaked the nameref cell itself ('ref=var', the target NAME as text) into the host env map, whose base is a full-table clone. invoke_host_external_command now removes nameref alias cells from that base clone, selected by the NAMEREF_VARS attribute set (never a name blacklist). The target cell stays, so nothing is lost; the prefix composition below (tempenv_export_name already resolves prefix names to their targets) is untouched, as is the rest of the channel contract (the clone still carries unexported non-prefix cells - issue1766_top_tempenv_restores_after_host_command pins a=14 in the second capture). Gate: tests/issue1766_host_env_prefix_regressions.rs 16/16 (was 14/16 on this branch). --------- Co-authored-by: 曹梦轩 <[email protected]>
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.
Fixes #1766
Cluster: carrier-host1766 (REPORT to follow in workspace rubash-fix9/clusters/carrier-host1766/REPORT.md).
Gates NOT yet landed (do not merge until the gate script reports green): issue file + carrier neighbors + lib failure set == this-tree baseline + diffcorpus subset of {ms10} + cargo check + per-file fmt. Known pre-existing caveat: the top-level compound-append exact value (GNU 1(9)) rides the carrier table fix in PR #1767; this PR pins no-marker-leak on that row until then.