diff --git a/tests/test_other.py b/tests/test_other.py index 17426844a825c..095d95d4f5bd4 100644 --- a/tests/test_other.py +++ b/tests/test_other.py @@ -7371,15 +7371,14 @@ def test_emar_duplicate_inputs(self): create_file('file1', ' ') self.run_process([EMAR, 'cr', 'file1.a', 'file1', 'file1']) - # Temporarily disabled to allow this llvm change to roll - # https://reviews.llvm.org/D69665 - @no_windows('Temporarily disabled under windows') def test_emar_response_file(self): # Test that special character such as single quotes in filenames survive being # sent via response file create_file("file'1", ' ') create_file("file'2", ' ') - building.emar('cr', 'libfoo.a', ("file'1", "file'2")) + create_file("hyvää päivää", ' ') + create_file("snowman freezes covid ☃ 🦠", ' ') + building.emar('cr', 'libfoo.a', ("file'1", "file'2", "hyvää päivää", "snowman freezes covid ☃ 🦠")) def test_archive_empty(self): # This test added because we had an issue with the AUTO_ARCHIVE_INDEXES failing on empty diff --git a/tools/response_file.py b/tools/response_file.py index 276796b600da2..d630c86b04d8e 100644 --- a/tools/response_file.py +++ b/tools/response_file.py @@ -7,6 +7,7 @@ import os import shlex import tempfile +from .utils import WINDOWS DEBUG = int(os.environ.get('EMCC_DEBUG', '0')) @@ -21,7 +22,10 @@ def create_response_file(args, directory): response_fd, response_filename = tempfile.mkstemp(prefix='emscripten_', suffix='.rsp', dir=directory, text=True) # Backslashes and other special chars need to be escaped in the response file. - escape_chars = ('\\', '\"', '\'') + escape_chars = ['\\', '\"'] + # When calling llvm-ar on Linux and macOS, single quote characters ' should be escaped. + if not WINDOWS: + escape_chars += ['\''] def escape(arg): for char in escape_chars: @@ -39,7 +43,7 @@ def escape(arg): with os.fdopen(response_fd, 'w') as f: f.write(contents) if DEBUG: - logging.warning('Creating response file ' + response_filename + ': ' + contents) + logging.warning('Creating response file ' + response_filename + ' with following contents: ' + contents) # Register the created .rsp file to be automatically cleaned up once this # process finishes, so that caller does not have to remember to do it.