[Bug 59550] New: Implement AppDefaults registry toggle for wcmd to sanitize forward slashes in execution paths (Resolves Unreal Engine update scripts)
http://bugs.winehq.org/show_bug.cgi?id=59550 Bug ID: 59550 Summary: Implement AppDefaults registry toggle for wcmd to sanitize forward slashes in execution paths (Resolves Unreal Engine update scripts) Product: Wine Version: 11.5 Hardware: arm OS: MacOS Status: UNCONFIRMED Severity: normal Priority: P2 Component: cmd Assignee: wine-bugs@list.winehq.org Reporter: smcclenahan@gmail.com Created attachment 80605 --> http://bugs.winehq.org/attachment.cgi?id=80605 wcmdmain.c Registry Hook for CmdForgiveSlashes Currently, wcmd strictly parses forward slashes (/) as command switches. When modern cross-platform engines (specifically Unreal Engine 4/5, e.g., Borderlands 4) attempt to launch background update scripts via cmd.exe /c, they frequently pass un-sanitized, mixed-slash paths (e.g., C:/users/.../PersistentDownloadDir/GbxRelaunch.bat). Because wcmd evaluates the slash as an invalid switch (e.g., /users), the execution fails instantly with an unrecognized command error. This breaks automatic game restarts and hotfix pipelines for numerous titles. (See attached terminal_output.txt for the exact error). Proposed Solution: Introduce an opt-in registry toggle within the AppDefaults hive that allows wcmd to sanitize forward slashes to backslashes for specific calling executables before parsing. * Registry Key: HKCU\Software\Wine\AppDefaults\[CallingProcess.exe] * Proposed Value: "CmdForgiveSlashes"="1" (String or DWORD) * Behavior: When wcmd is spawned, it checks the AppDefaults of the parent process. If the flag is present, a lightweight sanitization routine converts / to \ in the execution buffer before the standard wcmd parsing logic takes over. Architectural Rationale & Preempting Regressions: * Zero Regression Blast Radius: By defaulting to strict legacy parsing and requiring an explicit AppDefaults override, there is zero risk to legacy enterprise scripts, background redistributables, or unrelated software within the same WINEPREFIX. The execution state remains entirely deterministic. * Avoiding Hardcoded Hacks: This prevents the need to continuously merge game-specific string exceptions into the core wcmdmain.c codebase as new games release. * Empowering Downstream Wrappers: Native Windows cmd.exe occasionally relies on undocumented, dynamic heuristics to successfully execute these mixed-slash paths. Perfectly cloning those undocumented heuristics in wcmd is dangerous for legacy stability. Exposing this registry hook gives downstream maintainers (like Proton and CrossOver) a safe, standardized way to configure the environment via their own application profiles without patching Wine's core C code. (Proof of concept patch attached as wcmd_forgive_slashes.patch) -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59550 --- Comment #1 from smcclenahan@gmail.com --- Created attachment 80606 --> http://bugs.winehq.org/attachment.cgi?id=80606 terminal_output.txt -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59550 smcclenahan@gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #80606|file_59550.txt |terminal_output.txt filename| | Attachment #80606|terminal_output.txt |Terminal Output description| | -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59550 Eric Pouech <eric.pouech@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |eric.pouech@gmail.com --- Comment #2 from Eric Pouech <eric.pouech@gmail.com> --- can you describe exactly how the problem is triggered ? a small repro could be useful we first need to understand where failure comes from and where if Wine has a different behavior as Windows -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59550 --- Comment #3 from smcclenahan@gmail.com --- (In reply to Eric Pouech from comment #2)
can you describe exactly how the problem is triggered ? a small repro could be useful
See the terminal output attachment. A game exe is trying to run cmd.exe with a path that uses / instead of \. This runs as expected on windows but not on wine.
we first need to understand where failure comes from and where if Wine has a different behavior as Windows
The path delimiter in cmd.exe is a known issue and requests to emulate Microsoft’s version with all its quirks compared to wine implementation, have usually been rejected. Windows will sometimes translate / to \ if the path is on the file system. Wine version attempts no such test to stay compliant with older software where \ for path separation and / for command line options make a difference. I am proposing a user configurable option to enable it, instead of trying to emulate windows cmd.exe -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59550 --- Comment #4 from Eric Pouech <eric.pouech@gmail.com> --- (In reply to smcclenahan from comment #3)
See the terminal output attachment. the terminal output gives insight on where the error is triggered what I'm asking is the input to cmd.exe
A game exe is trying to run cmd.exe with how is it run? from CreateProcess, from ShellExecute, from inside another .bat, from inside another .cmd, from inside another .bat with start, from inside another .cmd with start, with start.exe, from another method ? which exact parameters? (with quotes, escapes, which parameters to cmd.exe? /s, /c, ...
I've tried a couple of these options without showing differences between Wine and Windows that's why I'm trying to find the set of input to trigger the problem -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59550 --- Comment #5 from smcclenahan@gmail.com --- I am unable to reproduce my particular use case at this time because it was a software update process which has since successfully completed so I won't get the error again like I always do until another update to the game is released. I don't know if or how I can profile the commercial application/game, maybe I can add some logging or debugging when I launch via Crossover and wait for the next update? I am not maintaining multiple versions I can test or rollback to, sorry. I have observed that the error has happened every single time there has been a software update (at least for this game, every month or so), the workaround is to just ignore it and manually restart but I'm trying to address the root cause for a smoother update for this and any other game with this known issue. I tested manually a command with / options and both \ and /-delimited path inside a Wine cmd session and it indeed works there: Z:\>cmd /c C:/windows/system32/attrib.exe (Success) However, I'm sure the failure will re-occur when the command is called programmatically from the game engine. This suggests the parsing discrepancy in wcmd occurs during the initial process startup (the transition from CreateProcessW arguments to wcmd's internal state?), rather than within the interactive shell parser. The exact failure log remains: Can't recognize 'C:/users/crossover/Documents/My Games/Borderlands 4/Saved/PersistentDownloadDir/GbxRelaunch.bat' as an internal or external command This indicates that when wcmd receives this string as its starting argument via /c from an external process (e.g. main game engine binary Unreal Engine 5), it is misinterpreting the first forward slash in the path as a switch. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59550 --- Comment #6 from Eric Pouech <eric.pouech@gmail.com> ---
This indicates that when wcmd receives this string as its starting argument via /c from an external process (e.g. main game engine binary Unreal Engine 5), it is misinterpreting the first forward slash in the path as a switch. this error message can be printed while trying to interpret any command (either passed with /c or when executing a .bat or .cmd with that command...)
when this happens running with WINEDEBUG=+process,+cmd,+start could log some more information it's very likely that the issue needs also to use path:s with spaces inside (in the log you provided both the target .bat and the current path contain spaces) -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
participants (1)
-
WineHQ Bugzilla