Repository navigation
Refs #3105 - #3127
Merged
Merged
Refs #3105#3127
Conversation
OS-argv positional parameters enter storage unencoded: a bare carrier byte in $1 is stripped as IFS_GLUE protocol when the value is finalized into a word, while storage-domain consumers (case, substring) still see it. GNU binds argv verbatim (shell.c:1505-1515 remember_args; variables.c:368 environ verbatim) — rubash's storage contract therefore requires every raw-data entry to encode at its boundary, the way environment import already does (rubash#2884). Cells: -c / script-file / -s argv faces, export to a real child, Session + StateViews set_positional, ShellInvocation apply, the $0/BASH_ARGV0 survey faces, plus controls (case, substring, env entry, marker-zone verbatim) and the set-builtin double-encode guard.
OS argv entered storage unencoded: a bare carrier byte (e.g. \x1c) in $1 stayed visible to storage-domain consumers (case, substring) but was stripped as IFS_GLUE protocol at word finalization, and was lost again on export to real children. GNU binds argv verbatim (shell.c:1505-1515 the -c face, shell.c:1613-1614 the script-name $0, variables.c:368 environ) because it has no transport domain; this engine's storage contract entry-encodes raw data, as the environment import already does, so the argv entries encode here. Landing points (raw data only): the -c / -s / script-file faces in main.rs, StateViews::set_positional, Session::set_positional, and ShellInvocation::apply_to_executor_before_startup, plus the BASH_ARGV0 raw-data seed family found by census (the env re-seed, the argv[0] display seed, the -c name operand, the script name, the invocation command_name). The shared set_positional_params setter is untouched: the set builtin, function calls and source args hand it cooked shell words, and encoding there would double-encode them. __RUBASH_* internal transport identity carriers keep raw spelling. Refs #3105
caomengxuan666
marked this pull request as ready for review
November 9, 2026 05:07
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.
Refs #3105
问题
OS-argv 位置参数未按存储域契约编码入存储:用户载体字节以裸字符进入 positional params,单词定型时裸 \x1c 被当作 IFS_GLUE 协议标记剥除——值在存储内「看得见」(case 匹配、子串提取都命中),展开成词却丢字节,导出给真子进程也丢。环境变量入口已由 #2884 在导入处编码,argv 入口没走。
GNU 锚点:shell.c:1505-1515(
-c形 dollar_vars 逐字绑定 + remember_args)、shell.c:1613-1614(脚本名)、variables.c:368 initialize_shell_variables(environ 逐字存)——GNU 无传输域故逐字即正确;rubash 有存储域契约,原始数据入口必须以数据编码(entry_encode_value_text,与 env 导入同一编码器)入存储。修法(队长已裁契约面)
编码落在原始数据入口,不动共用 setter
set_positional_params本体(set内建/函数调用给它的是熟词,落在 setter 必双重编码):-c形、脚本文件形、-s形)。StateViews::set_positional(api/views.rs)、Session::set_positional(api/session.rs)——宿主传原始数据、引擎在入口编码,签名不变。ShellInvocation::apply_to_executor_before_startup落存储前编码(invocation.rs)。BASH_ARGV0的原始数据种子(env 导入的原样复播种、argv[0] 显示形种子、-c名操作数、脚本名种子、invocation command_name 种子)——它是 shell 可见变量,按变量存储契约编码;__RUBASH_*内部传输身份名保持原样不动。substitution_metadata::entry_encode_value_text;二进制面复用既有公开bytes_to_shell_text(其 valid-text 臂与entry_encode_value_text的 escape 按模块文档恒等)。api-ledger 不动。本 PR 删除了什么
无删除。本 PR 为纯新增:各原始入口在落存储前逐值编码,回归钉一个文件。净行数以最终 diff 为准。
验证
UNVERIFIED-BY-CAPTAIN(车道自报,队长复核为准):钉 fail-first 与全腿数字见车道 REPORT。