Skip to content

export: apply att_exported even when the operand bind fails (Refs #3533) - #3587

Merged
caomengxuan666 merged 1 commit into
masterfrom
fix/3533-export-readonly-attr
Nov 15, 2026
Merged

caomengxuan666 merged 1 commit into
masterfrom
fix/3533-export-readonly-attr

Conversation

@caomengxuan666

@caomengxuan666 caomengxuan666 commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

Summary

GNU setattr.def binds the operand first (do_assignment_no_expand ->
bind_variable), then set_var_attribute applies the attribute change
regardless of the bind's success — export s=2 on a readonly s reports
err_readonly yet leaves declare -rx s, and export -n x=2 on a
readonly exported x still removes att_exported. rubash returned early on
the readonly refusal in both faces, skipping the attribute update.

Pin: tests/issue3533_export_readonly_attr.rs (4 cases).
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

GNU setattr.def binds the operand first (do_assignment_no_expand ->
bind_variable), then set_var_attribute applies the attribute change
regardless of the bind's success — `export s=2` on a readonly s reports
err_readonly yet leaves `declare -rx s`, and `export -n x=2` on a
readonly exported x still removes att_exported. rubash returned early on
the readonly refusal in both faces, skipping the attribute update.

Pin: tests/issue3533_export_readonly_attr.rs (4 cases).
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@caomengxuan666
caomengxuan666 force-pushed the fix/3533-export-readonly-attr branch from 4405ddc to fe9153b Compare November 14, 2026 14:18
@caomengxuan666 caomengxuan666 changed the title test export: apply att_exported even when the operand bind fails (Refs #3533) Nov 14, 2026
@caomengxuan666
caomengxuan666 marked this pull request as draft November 14, 2026 14:18
@caomengxuan666

Copy link
Copy Markdown
Member Author

【WIN-AGENT-AUDIT】
PR #3587 第1轮 — 建议:PASS
head: fe9153b base(merge-base): 96802ca 文件: 2 个 +66/-0
关联 issue: #3533(状态:open,我核过的时间:2026-11-15 本机)

机制核查:

  • GNU 源核对:setattr.def:274 do_assignment_no_expand(name)(失败仅 assign_error++),随后 setattr.def:281 set_var_attribute(name, attribute, undo) 无条件应用属性——属性应用不依赖 bind 成败。PR 在两处 readonly-早退路径补 mark_exported/unmark_exported+unset_process_env(-n 臂),与 GNU 顺序一致。
  • WSL GNU 5.3.20 oracle(脚本 target/probe-3533.sh):export s=2 readonly → err_readonly + declare -rx s="1";export t=3 readonly → declare -rx t;export -n x=2 readonly → declare -r x="1" —— 三个钉期望与 GNU 完全一致。
  • 无关改动:无;-n 臂的 unset_process_env 注释正确标注 [perf] export/unset per-op cost ~100x: 2k dynamic export+unset 13x slower than bash #916/perf(env): gate the process-env mirror on special names (#916) #917 语义。

腿(逐项):

  • 钉自跑:cargo test --test issue3533_export_readonly_attr --locked @fe9153b3 → 4 passed / 0 failed。
  • fail-first:同钉放 merge-base 96802ca → 1 passed / 3 failed,红名 = {export_assignment_on_readonly_still_marks_exported, export_on_unset_readonly_still_marks_exported, export_unset_on_readonly_still_unmarks_exported},与 PR 声称形状一致(base 输出 declare -r s="1",head declare -rx s="1")。failed_export_assignment_keeps_prior_value 双边绿(非发散面,合理)。
  • lib 双边(经 CI 代跑):head lib = 1350P/1F {issue2875}(win)+ 1243P/1F {issue2875}(mac);base master 同红。差集 {∅}。
  • -D warnings:未跑全量(构建日志无警告输出;改动为两行调用,无签名变化)。
  • 卫生:改动与钉文件 rustfmt 直检 0 diff。
  • CI:三红任务名全 = {issue2875_input_procsub_child_runs_as_rubash_shell} —— 基线。
  • GNU 对照:WSL bash 5.3.20(/usr/local/bin/bash),三形状全一致(上)。

F 点:无。
续作记录:无。
未跑/VOID 的腿:-D warnings 全量(增量编译未见警告,记为未跑项供队长复核)。

@caomengxuan666

Copy link
Copy Markdown
Member Author

【队长终裁】PASS

核过审计报告(6885864262)+ CI 全表。钉 4/4,fail-first 1/3(3 红 = issue 形状:base 输出 declare -r s="1",head declare -rx s="1");GNU oracle 三形状全一致(setattr.def:274/281 顺序);CI 三红红名全为 issue2875 基线;fmt 干净。合入条件:与 #3536 的 #3533 export 面重叠裁断先行——两单均动 export 面,合入前队长先核 #3536 的 hunk 表,确认无重叠再合其中一支;另一支 update-branch + 合并形重验。本单合入正文 Refs #3533(#3533 保持 OPEN,待 #3536 面一并裁断后关)。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant