Skip to content

Commit af4c96f

Browse files
speak-agentclaude
andcommitted
#708: an action's cwd is a plain absolute path on Windows
The wrapper entered the action's directory in `extended_length`'s `\\?\` spelling. Windows accepts that as the current directory, but a child started there does not recognise it: on the Windows e2e job the MSYS shell of e2e 799 ran in C:\Windows while the variable reached it. The wrapper now enters the absolute, lexically normal path; POSIX is unaffected, since extended_length returns its argument unchanged there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 6b6cfbd commit af4c96f

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

‎src/cli.cppm‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,9 +1084,16 @@ int run(int argc, char** argv) {
10841084
std::filesystem::path{requireDir}, aec).string();
10851085
}
10861086
if (!cwd.empty()) {
1087+
// The directory the command inherits is a plain absolute path, not
1088+
// `extended_length`'s `\\?\` form: that form is a spelling for
1089+
// opening files. Windows accepts it as the current directory, but
1090+
// a child started there does not recognise it -- an MSYS shell ran
1091+
// in C:\Windows instead (e2e 799) -- and a working directory is
1092+
// limited to MAX_PATH in either spelling.
10871093
std::error_code cec;
1088-
std::filesystem::current_path(
1089-
mcpp::platform::fs::extended_length(std::filesystem::path{cwd}), cec);
1094+
const auto dir = std::filesystem::absolute(std::filesystem::path{cwd}, cec)
1095+
.lexically_normal();
1096+
if (!cec) std::filesystem::current_path(dir, cec);
10901097
if (cec) {
10911098
std::println(stderr, "error: cannot enter the action's directory '{}': {}",
10921099
cwd, cec.message());

0 commit comments

Comments
 (0)