Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ports] Enable use of "::" to escape options separator #21710

Merged
merged 3 commits into from
Apr 9, 2024

Conversation

ypujante
Copy link
Contributor

@ypujante ypujante commented Apr 6, 2024

This PR addresses the issue that there is no way to have a port option value containing a ":" since it is the option separator.

The fix is to allow the escape sequence "::" similar to "\\" in strings or "%%" in printf format strings.

Python proof of concept:

>>> s = 'abc::def'
>>> s
'abc::def'
>>> s.replace('::', '\0')
'abc\x00def'
>>> s.replace('::', '\0').replace('\0', ':')
'abc:def'

The implementation replaces :: with \0 (the char(0) NOT the character "0") before splitting and then replaces \0 with : after the split.

@ypujante
Copy link
Contributor Author

ypujante commented Apr 6, 2024

The reported tests failures are, none of which seems to be related to my changes.

======================================================================
ERROR [61.229s]: test_offset_converter (test_browser.browser)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/root/project/test/common.py", line 2063, in run_browser
    self.assertContained(expected, output)
  File "/root/project/test/common.py", line 1393, in assertContained
    additional_info
  File "/usr/lib/python3.6/unittest/case.py", line 670, in fail
    raise self.failureException(msg)
AssertionError: Expected to find '/report_result?exit:1
' in '[no http server activity]
', diff:
======================================================================
FAIL [2.716s]: test_wasmfs_opfs_jspi (test_browser.browser)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/root/project/test/common.py", line 2063, in run_browser
    self.assertContained(expected, output)
  File "/root/project/test/common.py", line 1393, in assertContained
    additional_info
  File "/usr/lib/python3.6/unittest/case.py", line 670, in fail
    raise self.failureException(msg)
AssertionError: Expected to find '/report_result?exit:0
' in '/report_result?exception:Maximum call stack size exceeded / RangeError: Maximum call stack size exceeded    at http://localhost:8888/test.wasm:wasm-function[108]:0x6e2a    at http://localhost:8888/test.wasm:wasm-function[44]:0xf68    at http://localhost:8888/test.wasm:wasm-function[167]:0xda8d    at http://localhost:8888/test.wasm:wasm-function[127]:0xae45    at http://localhost:8888/test.wasm:wasm-function[266]:0x10681    at http://localhost:8888/test.wasm:wasm-function[197]:0xe7ce
', diff:

======================================================================
FAIL [2.653s]: test_wasmfs_opfs_jspi_wasm_bigint (test_browser.browser)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/root/project/test/common.py", line 2063, in run_browser
    self.assertContained(expected, output)
  File "/root/project/test/common.py", line 1393, in assertContained
    additional_info
  File "/usr/lib/python3.6/unittest/case.py", line 670, in fail
    raise self.failureException(msg)
AssertionError: Expected to find '/report_result?exit:0
' in '/report_result?exception:Maximum call stack size exceeded / RangeError: Maximum call stack size exceeded    at http://localhost:8888/test.wasm:wasm-function[106]:0x6ab5    at http://localhost:8888/test.wasm:wasm-function[43]:0xf5a    at http://localhost:8888/test.wasm:wasm-function[166]:0xd78a    at http://localhost:8888/test.wasm:wasm-function[125]:0xaad7    at http://localhost:8888/test.wasm:wasm-function[263]:0x10303    at http://localhost:8888/test.wasm:wasm-function[196]:0xe4c2
', diff:

@ypujante
Copy link
Contributor Author

ypujante commented Apr 9, 2024

I merged with latest branch and all is green.

@sbc100 sbc100 merged commit d3fca85 into emscripten-core:main Apr 9, 2024
29 checks passed
@ypujante ypujante deleted the ports-escape-separator branch April 11, 2024 16:25
impact-maker pushed a commit to impact-maker/emscripten that referenced this pull request Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants