Skip to content

[bug] 1.x C++ tmp_base_w 的 /tmp 解析在 Git Bash 父进程下循环映射(TEMP=/tmp → /tmp) #1769

Closed

Description

@caomengxuan666

winux-core path.rs 的 Rust 移植修复同类问题时的发现(CI gate mk16-p-dir 行,rust2 侧修复为 skip POSIX 形式 + GetTempPathW 兜底)。

现象:父进程为 Git Bash 时,TEMP/TMP 以 MSYS 形式 /tmp 导出到子进程环境。1.x C++ 的 tmp_base_w(native_path.cppm:176)按 niubash#94 优先级 TMPDIR>TEMP>TMP 信任该值 → /tmp 解析回 /tmp → 循环映射 → 一切临时文件命令(mktemp 等)写向不存在的 Windows 路径。

复现:Git Bash 下 TEMP=/tmp winuxcmd mktemp -p /tmp x.XXXXXX → 失败;同命令在 cmd/PowerShell/niubash 父进程下成功。

rust2 侧修法(已落地 winux-core path.rs tmp_base):POSIX 形式(前导 /)的候选跳过,继续 TMPDIR>TEMP>TMP 优先级;全为 POSIX 形式时 GetTempPathW 兜底(其自身会跳过不存在的候选落到 USERPROFILE)。C++ 侧同法即可。

影响面:所有经 /tmp 的 1.x 命令在 Git Bash 父进程下;niubash 父进程不受影响(其 TEMP 为 Windows 形式)。

Activity

  1. added
    bug
    on Nov 15, 2026
  2. added
    compat-gap
    on Nov 15, 2026
  3. added a commit that references this issue on Nov 17, 2026
    7cf7bde
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugcompat-gap

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions