GEOS-DEV / GEOS-DEV/GEOS

SymbolicFunction expression containing commas inputs fail XML validation

Open
#1,771 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: bug
Dominant language
C++
Stars
287
Forks
109
Avg merge
4d 41m
Merged PRs (30d)
5

Description

Describe the bug
A really minor inconvenience, but a SymbolicFunction expression with commas (which are necessary for using some binary functions, e.g. pow(x,y)) fails validation, because our validation regex pattern for strings does not allow commas.

To Reproduce
Steps to reproduce the behavior:

  1. Modify examples/functions/function_examples/function_examples.xml to use a binary builtin function (e.g. pow)
  2. Run the full build up to the XML validation step
  3. Get error message like
ERROR:SCHEMASV:SCHEMAV_CVC_PATTERN_VALID: Element 'SymbolicFunction', attribute 'expression': [facet 'pattern'] The value 'pow(x,1.5)' is not accepted by the pattern '.*[\[\]`$].*|[^,\{\}]*'.

Expected behavior
Should not fail validation.

Additional context
The reason to not allow commas in string inputs is probably so that regex for string_array is unambiguous (it adds commas between array elements). But I suspect if we allowed it, validation would still work fine, the regex would possibly match a different number of strings (when some are separated by commas with no spaces, they may get mashed into one). This doesn't affect the actual GEOSX parser in any case. Instead, we should prohibit spaces in string regex, because a space is never read by operator>> so a string like "ab cd" will validate but GEOSX will only read "ab".

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with examples/functions/function_examples/function_examples.xml and reproduce the failure using a binary function such as pow(x,1.5), then locate the string-input validation pattern used during the XML validation step. Run the full build through XML validation; done means comma-containing SymbolicFunction expressions pass while space handling remains consistent with the parser.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.