Skip to content

-gsource-map does not work on Windows if username contains non-ASCII Unicode characters. #24557

Closed
@juj

Description

@juj

If username has non-ASCII Unicode characters, then on Windows the TEMP environment variable will point to a path that has Unicode chars in it (e.g. TEMP=C:\Users\Matti Meikäläinen\AppData\Local\Temp)

In such a mode, using -gsource-map command line flag fails on Windows.

e.g.

C:\ä ö\emsdk\emscripten\main>set TEMP
TEMP=C:\ä ö\temp

C:\ä ö\emsdk\emscripten\main>test\runner other.test_wasm_sourcemap_relative_paths
Running test_other: (1 tests)
test_wasm_sourcemap_relative_paths (test_other.other.test_wasm_sourcemap_relative_paths) ... a.cpp a.cpp
   a.cpp
     same CWD for compiler and linker
FAIL

======================================================================
FAIL: test_wasm_sourcemap_relative_paths (test_other.other.test_wasm_sourcemap_relative_paths)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\ä ö\emsdk\emscripten\main\test\test_other.py", line 10781, in test_wasm_sourcemap_relative_paths
    test('a.cpp')
    ~~~~^^^^^^^^^
  File "C:\ä ö\emsdk\emscripten\main\test\test_other.py", line 10774, in test
    self.assertIn('"%s"' % expected_source_map_path, read_file('a.out.wasm.map'))
    ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: '"a.cpp"' not found in '{"version":3,"sources":["../../../../../../303/244 /303/266/emsdk/emscripten/main/out/test/a.cpp","/emsdk/emscripten/system/lib/compiler-rt/stack_ops.S","/emsdk/emscripten/system/lib/compiler-rt/stack_limits.S","/emsdk/emscripten/system/lib/pthread/library_pthread_stub.c","/emsdk/emscripten/system/lib/libc/musl/src/stdio/ofl.c","/emsdk/emscripten/system/lib/libc/musl/src/stdio/__lockfile.c","/emsdk/emscripten/system/lib/libc/musl/src/stdio/fflush.c"],"sourcesContent":[],"names":[],"mappings":"6XAOA,iCACE,QAAA,kBCQF,GACA,MACA,KAKA,MAEA,EAEA,CAEA,EACA,CACA,EACA,MACA,EACA,EAIA,OACA,ECWA,OAEA,MAMA,MAGA,EACA,CACA,EACA,CACA,MAEA,EAYA,OACA,MACA,CACA,EAnDA,OACA,EAIA,OACA,GCmVwB,GAEE,GChXzB,YACA,MAAA,GAKA,YACD,ECbA,GAaC,GASD,MCjBK,UAEC,cAA2B,SAAP,aACpB,UAA2B,SAAP,MAAH,MAEb,QAAV,GAAE,KACC,oBAAA,GAAA,QAEA,IADO,OAAW,KAAN,GAAkB,QAAH,MAC3B,eAHH,KAAE,MAKA,MAyBF,IApBC,kBAAA,GAAA,QAkBA,IAfO,WAAW,KAAN,SACX,iBACQ,KAAJ,MACH,QAMK,OAAW,OAAN,KAA8B,OAAP,GAAX,0BAGL,OAAU,OACrB,GAER,cAED,EAAA"}'

----------------------------------------------------------------------
Ran 1 test in 0.533s

FAILED (failures=1)

C:\ä ö\emsdk\emscripten\main>

It looks like the source map generation has generated an incorrect source path:

"../../../../../../303/244 /303/266/emsdk/emscripten/main/out/test/a.cpp"

when it was expected to have resolved to just a.cpp.

If the TEMP directory points to a path without Unicode chars, then the test passes on Windows.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions