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

MiniWDL does not properly support the POSIX regex standard #709

Open
stxue1 opened this issue Jul 26, 2024 · 0 comments
Open

MiniWDL does not properly support the POSIX regex standard #709

stxue1 opened this issue Jul 26, 2024 · 0 comments
Labels
interop Bears on spec compatibility

Comments

@stxue1
Copy link

stxue1 commented Jul 26, 2024

The WDL spec says that regular expressions must be evaluated as POSIX ERE.

MiniWDL does attempt to support the POSIX standard:

pattern_re = regex.compile(pattern.value, flags=regex.POSIX) # pylint: disable=E1101

One of the character classes the POSIX standard supports is [:alpha:]

MiniWDL does not properly support the character classes. For example, in the WDL file below:

version 1.1

workflow test_sub {
  String string_to_sub = "word"

  output {
    String out = sub(string_to_sub, "[:alpha:]{4}", "4444")
  }
}

miniwdl returns:

{
  "dir": "/home/heaucques/Documents/wdl-conformance-tests/20240726_121643_test_sub",
  "outputs": {
    "test_sub.out": "word"
  }
}

I think this is due to the regex pypi library that miniwdl uses. While it says it supports the POSIX standard, the syntax is a little different than what is expected:
https://github.com/mrabarnett/mrab-regex?tab=readme-ov-file#posix-character-classes

Replacing [:alpha:] with [[:alpha:]] as per the regex documentation allows the substitution to work:

version 1.1

workflow test_sub {
  String string_to_sub = "word"

  output {
    String out = sub(string_to_sub, "[[:alpha:]]{4}", "4444")
  }
}
{
  "dir": "/home/heaucques/Documents/wdl-conformance-tests/20240726_121923_test_sub",
  "outputs": {
    "test_sub.out": "4444"
  }
}

The substitution unit test in the WDL spec depends on this behavior, meaning MiniWDL does not currently pass it:
https://github.com/openwdl/wdl/blob/9c0b9cf4586508a9e6260cc5c5e562e21f625aac/SPEC.md?plain=1#L6480-L6496

@mlin mlin added the interop Bears on spec compatibility label Nov 20, 2024
@mlin mlin added this to miniwdl Nov 20, 2024
@github-project-automation github-project-automation bot moved this to Backlog in miniwdl Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interop Bears on spec compatibility
Projects
Status: Backlog
Development

No branches or pull requests

2 participants