Skip to content

fix: redact home paths in profile runner logs - #262

Open
chen2021673 wants to merge 1 commit into
masterfrom
fix/run-models-profile-redaction
Open

chen2021673 wants to merge 1 commit into
masterfrom
fix/run-models-profile-redaction

Conversation

@chen2021673

Copy link
Copy Markdown
Collaborator

Summary

为 run_models_and_profile.bash 增加日志路径脱敏,避免在控制台输出和上传的运行日志中输出本机用户目录;同时保证脱敏过滤在命令失败时也能完整落盘,并兼容 macOS 的 sed 实现。

Changes

  • 新增 redact_log_paths 过滤函数,统一处理 /home/<user>、/Users/<user>、/root、~/ 等常见用户路径前缀,替换为 <home>;/root 仅在独立路径边界生效,不会误伤 /rootdir、/root_foo 等目录名。
  • 命令的 stdout/stderr 改为经脱敏过滤器写入日志文件,并在读取失败日志前等待过滤器退出、完成刷盘,避免尾部输出丢失。
  • 控制台中的命令、CMake 命令、日志目录、checkpoint 清理、profile 文件移动、比较脚本输出等均经过脱敏。
  • run_metadata.log 与各用例日志改用相对路径记录(../run_metadata.log),metadata 中仅记录 config 文件名和 logs / profile_logs,不再写入绝对路径。
  • 手动比较命令和最终 Feishu 写表提示改用相对路径。
  • sed 缓冲参数改为启动时探测:GNU sed 使用 -u,BSD/macOS sed 回退到默认缓冲(调用方已有 wait/flush 兜底),不再依赖 GNU-only 的 sed -u 与 realpath --relative-to。

Filter home-directory prefixes from console output, command metadata, and
streamed command logs. Route command stdout/stderr through the redaction
filter and wait for it to flush before reporting failures so trailing
output is not lost.

Record the metadata file location relative to each tag log directory and
keep manual next-step hints relative. Detect GNU sed unbuffered-mode
support so the redaction filter also works with BSD/macOS sed.
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