@@ -48,6 +48,28 @@ bool replace_record(const fs::path& path,std::string_view bytes,std::string* dia
4848 }
4949 noReplaceCode=static_cast <int >(noReplace.error ().code );
5050 }
51+ #if defined(_WIN32)
52+ // CI-only root-cause probe. Remove before merge: it intentionally
53+ // compares the standard library's rename of this exact source to
54+ // a distinct diagnostic name, without publishing the status.
55+ if (noReplaceCode==static_cast <int >(os::errc::invalid)
56+ && std::getenv (" MCPP_TEST_NATIVE_RENAME" )!=nullptr ) {
57+ const auto sourceLocation=os::fs::locate (temporary);
58+ const auto targetLocation=os::fs::locate (path);
59+ const auto readable=os::fs::read (temporary);
60+ auto probe=temporary;probe+=" .diagnostic" ;
61+ std::error_code nativeError;
62+ fs::rename (temporary,probe,nativeError);
63+ if (!nativeError) {std::error_code ignored;fs::remove (probe,ignored);}
64+ std::println (std::cerr,
65+ " mcpp: CI rename probe source-rel {} target-rel {} same-root {} KAL-read {} std-rename-code {} category {}" ,
66+ sourceLocation?sourceLocation->relative .size ():0 ,
67+ targetLocation?targetLocation->relative .size ():0 ,
68+ sourceLocation&&targetLocation&&sourceLocation->directory ==targetLocation->directory ,
69+ readable?0 :static_cast <int >(readable.error ().code ),
70+ nativeError.value (),nativeError.category ().name ());
71+ }
72+ #endif
5173 *diagnostic=std::format (" rename temporary (condition {}, native {}; source regular {} ec {}; target exists {} ec {}; no-replace condition {})" ,
5274 static_cast <int >(renamed.error ().code ),renamed.error ().native ,
5375 fs::is_regular_file (source),sourceError.value (),fs::exists (target),targetError.value (),noReplaceCode);
0 commit comments