Repository navigation
Fix Windows 8.3 short path and symlink handling in file_packager.py - #28192
Conversation
Use os.path.realpath(os.getcwd()) instead of os.path.abspath(os.getcwd()) when computing curr_abspath so it matches other abspath checks below. On Windows, os.getcwd() preserves directory junctions and 8.3 short path names (such as C:\Users\RUNNER~1\AppData\Local\Temp for user runneradmin), whereas os.path.realpath() expands them via GetFinalPathNameByHandleW. That mismatch caused abspath.startswith(curr_abspath) to reject valid --embed-file and --preload-file inputs inside the current working directory.
There was a problem hiding this comment.
Code Review
This pull request updates tools/file_packager.py to use os.path.realpath(os.getcwd()) instead of os.path.abspath(os.getcwd()) to ensure directory junctions, symlinks, and 8.3 short names are properly resolved on Windows. There are no review comments, so we have no feedback to provide.
sbc100
left a comment
There was a problem hiding this comment.
Anywhere else in the codebase we need to do this too?
Along with #28195 all the tests pass on the GHA runner where %TEMP% has the 8.3 shortname. (It's possible that there could be even more issues with running the compiler from such a directory, but it also seems likely that some of our users are running emcc from such a directory already). This issue is probably pretty obscure as well, since the file package is not frequently used. |
Use os.path.realpath(os.getcwd()) instead of os.path.abspath(os.getcwd()) when computing curr_abspath so it matches other abspath checks below.
On Windows, os.getcwd() preserves directory junctions and 8.3 short path names (such as C:\Users\RUNNER~1\AppData\Local\Temp for user runneradmin), whereas os.path.realpath() expands them via GetFinalPathNameByHandleW. That mismatch caused abspath.startswith(curr_abspath) to reject valid --embed-file and --preload-file inputs inside the current working directory.