Repository navigation
fix(executor): decode produced carriers at the subscript eval expand (Refs #3613) - #3629
Merged
Merged
Conversation
…(Refs #3613) declare -a b=([${x}]=v) with x='$y', y='`echo 1`' reported error token $'`e30a`y' (PUA carrier leak) and bound b=() — GNU reports `echo 1` and leaves b declared-but-unset. GNU: expand_words_no_vars expands the element word (${x} -> $y); array_expand_index's expand_arith_string (arrayfunc.c:1368) re-expands ($y -> `echo 1`); evalexp fails on the junk token `echo 1` -> evalerror -> DISCARD before the bind, keeping the -a mark. - expand_arithmetic_subscript_mut (+ its array_expand_once arm) decodes the E30x produced-data carriers on input so the expand-again pass sees plain text; produced bytes re-mark themselves during that pass. - declare_local's rewrite Err arm now abandons the operand on evalerror (same arm as the failglob gate) while recording the ARRAY/ASSOC + DECLARED_UNSET marks GNU keeps — declare -p b prints 'declare -a b'. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Member
Author
|
【WIN-AGENT-AUDIT s1】 PR #3629 第1轮 — 建议:PENDING(机制与钉腿全证;卡在 #3608 合入后的文本冲突,需 rebase 后重报) 机制核查:
腿(逐项给数字与名字):
合流阻塞(PENDING 原因,非机制缺陷):
F 点:无(机制层无缺陷;阻塞为合流态) 续作记录:本轮未动代码(冲突处置归作者/调度) 未跑/VOID 的腿:无 |
…#3613) Conflict: src/executor/arithmetic/mod.rs only. #3608 (4e2c529) replaced the two-state array_expand_once gate in eval_indexed_subscript_expression with the three-state `expand` split, so the #3613 carrier decode moves into the `else if array_expand_once` arm (AV_NOEXPAND: text stays verbatim for evalexp) and stays at the expand_arithmetic_subscript_mut entry (the expand_arith_string pass must re-lex decoded bytes). #2701's `${...}` fatal latch from master now reads the decoded text — that is what GNU's expand_arith_string (arrayfunc.c:1368 -> subst.c:3981) re-reads. Both pin stems green after the merge: issue3613 4/4, issue3522_unset_indexed_backquote_subscript 22/22, issue2701 12/12.
Member
Author
|
【WIN-AGENT-AUDIT s1】 PR #3629 第2轮 — 建议:PASS(冲突已解,全腿在解冲突后的 head 上复证) 合流处置(本轮唯一动过的东西):
机制核查(复证,未改判):
腿(逐项数字与名字):
相邻残差(base 已存在,非本 PR,建议另开工单,不在本条阻塞):
F 点:无 续作记录:只做合流,未改产品语义。commit 242085a(解 #3608 三态门冲突)、4c28cbe0(追平 master 1a51222);新 head 4c28cbe(远端已确认为此 oid)。 未跑/VOID 的腿:无 |
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 #3613.
declare -a b=([${x}]=v)withy='echo 1'/x='$y'reported error token<E30A>y(PUA carrier leak) and boundb=()— GNU reports`echo 1`and leavesbdeclared-but-unset (declare -a b).GNU layering (arrayfunc.c:1368
array_expand_index→expand_arith_string→evalexp): the element word expands once (${x}→$y), the subscript expands again ($y→`echo 1`), andevalexpfails on the junk token →evalerror→ DISCARD before the bind, keeping the-amark.Changes:
expand_arithmetic_subscript_mut(and thearray_expand_onceverbatim arm ofeval_indexed_subscript_expression) decodes the E30x produced-data carriers on input so the expand-again pass sees plain text — the produced$expands again and the produced`is data.declare_local's rewriteErrarm abandons the operand onevalerror_pending(same arm as the failglob gate) while recording the ARRAY/ASSOC + DECLARED_UNSET marks —declare -p bprintsdeclare -a b.Verified byte-identical to GNU (modulo the repo-wide
arithmetic syntax errorprefix difference vs 5.1): token`echo 1`, rc=1,declare -a bfor the declare arm;b=()still binds for plainb=([${x}]=v);a[${x}]=vreports$yon both;set -uunbound subscript aborts identically. 4 new regression pins in tests/issue3613_compound_declare_triple_expand.rs.