Repository navigation
fix: PUA 码点 U+E401 与内部 marker 冲突 (#735) - #791
Merged
Merged
Conversation
Contributor
|
欢迎!这是你的第一个 PR 🎉 请确认已跑过本地测试套件;CI 通过后维护者会 review。 |
This was referenced Oct 18, 2026
caomengxuan666
added a commit
that referenced
this pull request
Oct 18, 2026
…d splice (#796) v2=$'p\nq'$(echo r)s stored 6 characters where GNU bash 5.3.0 stores 5 (p newline q r s): one ANSI_C_IFS_GUARD byte reached the cell. #791 extended the marker zone to cover U+E401 (rubash#735), which re-routes the guard through the mixed command-substitution splice's payload re-encoding: the bare guard crosses append_expanded_shell_text and materializes as an E400-escaped pair, and the assignment funnel's tail strip must then PRESERVE that pair as #735 user data - so the transport carrier survived into storage. The guard is field-split transport (rubash#379), and an assignment value never field-splits, so the boundary that drops it is the fragment boundary BEFORE the payload splice. Strip the bare guard from the prefix and suffix fragments of expand_mixed_command_substitution_assignment. Differential pins (tests/issue379_ansic_blank_between_comsubs_ regressions.rs::assignment_comsub_fragments_store_clean_values, byte-verified against the WSL GNU 5.3.0(1)-release oracle): prefix, suffix and both-adjacent fragments store clean lengths 5/4/5, and the for-list face keeps the decoded newline literal while field-splitting only the substitution output.
caomengxuan666
added a commit
that referenced
this pull request
Oct 18, 2026
…d splice (#796) v2=$'p\nq'$(echo r)s stored 6 characters where GNU bash 5.3.0 stores 5 (p newline q r s): one ANSI_C_IFS_GUARD byte reached the cell. #791 extended the marker zone to cover U+E401 (rubash#735), which re-routes the guard through the mixed command-substitution splice's payload re-encoding: the bare guard crosses append_expanded_shell_text and materializes as an E400-escaped pair, and the assignment funnel's tail strip must then PRESERVE that pair as #735 user data - so the transport carrier survived into storage. The guard is field-split transport (rubash#379), and an assignment value never field-splits, so the boundary that drops it is the fragment boundary BEFORE the payload splice. Strip the bare guard from the prefix and suffix fragments of expand_mixed_command_substitution_assignment. Differential pins (tests/issue379_ansic_blank_between_comsubs_ regressions.rs::assignment_comsub_fragments_store_clean_values, byte-verified against the WSL GNU 5.3.0(1)-release oracle): prefix, suffix and both-adjacent fragments store clean lengths 5/4/5, and the for-list face keeps the decoded newline literal while field-splitting only the substitution output.
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.
Closes #735
缺陷 1:$'\uE401' 被静默吞掉
ANSI_C_IFS_GUARD(U+E401)落在 marker zone(E000..E3FF)之外,又没进注册表——push_literal_char不转义它,之后被 guard strip 当成内部 marker 吃掉了。缺陷 2:${#var} 计数错误
parameter_char_length只在含 E000 时解码,把转义引导 E400 本身也数进去了。改动
src/executor/markers.rs:MARKER_ZONE_LAST扩到 0xE401;新增 E400-aware 的 guard helper(strip_ansi_c_ifs_guard_cow、ansi_c_ifs_guard_to_ifs_glue等)。expand_braced_indices.rs、assignment_expansion.rs、command_prepare.rs、command_words.rs、conditional.rs、expand_word.rs)。验证
修复后与 GNU bash 逐字节一致;新回归测试
tests/issue735_pua_marker_collision.rs5/5 通过。遗留(超出 scope)
read读入 U+E401 输出为空;脚本源码字面量 U+E401(非 $'\u..." 形式)仍被吞——lexer 字面量路径从不调push_literal_char(约 20 处拷贝点),建议另开 issue 跟踪。