godot: Engine hangs when trying to preload a resource from script starting with OS reserved names

Godot version: 3.0+, 4.0+

OS/device including version: Windows 10 1803 build 17134.165

Issue description: I have tried to preload a script condition.gd using relative path:

gif

const Condition = preload("con 
# engine hangs after `con` is typed

After that the engine hangs (no crash), with the following output (master, in official just hangs the engine)

WARNING: _open: Case mismatch opening requested file 'con.remap', stored as 'con' in the filesystem. This file will not open when exported to other case-sensitive platforms.
     At: drivers/windows/file_access_windows.cpp:102

The issue is most likely related to the fact that parser tries to manipulate OS reserved names as pointed by KellyThomas

Workaround: gif2

😄

Minimal reproduction project: con-preload-hang.zip

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 18 (17 by maintainers)

Commits related to this issue

Most upvoted comments

Probably related to this constraint:

Do not use the following reserved names for the name of a file: CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9. Also avoid these names followed immediately by an extension; for example, NUL.txt is not recommended.

https://docs.microsoft.com/en-us/windows/desktop/fileio/naming-a-file

We can explicitly tell the Win32 apis we want files by prefixing all types with \\?\. This will let a particular string straight through to the windows file apis without going through the other namespaces so \\?\c:\con is fine.

Doesn’t this in effect result in Godot creating files that are problematic to handle with other, non-prefix-aware programs? Because \\?\c:\con would then be fine for us, but feels like that may result in issues with other programs still. Also this should be fairly fast to compare against a blacklist compared to the already quite slow file operations.

@hpvb That sounds like an interesting option.

Whatever fix we choose, we must ensure that it doesn’t make cross-platform dev and export more cumbersome. The proposed fix in #25805 would imply that some names can’t be used while on Windows, but you can use them while on Linux and export a broken Windows build, which isn’t good.