ocaml-re
ocaml-re copied to clipboard
re 1.12 broke tests in a dose3
All tests associated with comparing versions through semver in dose3-7.0.0 are breaking. I think that arrays are incorrectly filled when analyzing the version by regular expression.
With ocaml-re 1.11 everything works fine.
And with ocaml-re 1.12: FAILED: Cases: 112 Tried: 112 Errors: 0 Failures: 21 Skip: 0 Todo: 0 Timeouts: 0.
One example of the output from the list of broken tests:
Failure: suite:5:test_decompose:5: =1.2.3 expected: 1.2.3-+ but got: 1.2.3
part of the src/versioning/semverNode.ml from dose3:
let rex =
Pcre.regexp
("^\\s*[v=]*\\s*"
(* optional version identifier *)
^ "([0-9]+|[xX*])(\\.([0-9]+|[xX*])?(\\.([0-9]+|[xX*])?)?)?"
(* 3-dotted notation *)
^ "(?:-((?:[a-zA-Z0-9]+|[a-zA-Z0-9-])(?:\\.[a-zA-Z0-9]+|[a-zA-Z0-9-])*))?"
^ (* pre release *)
"(?:\\+([0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?\\s*$" (* build indentifier *)
)
let sep_re = Pcre.regexp "\\."
let parse_raw_version version =
try
let parsed = Pcre.extract ~rex version in
let pre = Pcre.split ~rex:sep_re parsed.(6) in
let build = Pcre.split ~rex:sep_re parsed.(7) in
(parsed.(1), parsed.(3), parsed.(5), pre, build)
with Not_found ->
raise
(Invalid_argument
(Printf.sprintf "%s: Parsing Error. Invalid Version" version))
Thanks for the report. Can you give me an example of a version string from your test suite that parse_raw_version isn't parsing correctly?
All versions from test_decompose, except 1.2.3-beta+build:
[ ("v1.2.3", "1.2.3");
("=1.2.3", "1.2.3");
("v 1.2.3", "1.2.3");
("= 1.2.3", "1.2.3");
(" v1.2.3", "1.2.3");
(" =1.2.3", "1.2.3");
(" v 1.2.3", "1.2.3");
(" = 1.2.3", "1.2.3");
("1.2.3-0", "1.2.3-0");
("v1.2.3-1", "1.2.3-1");
("v1.2.3-beta", "1.2.3-beta");
("=1.2.3-beta", "1.2.3-beta");
("1.2.3-beta", "1.2.3-beta");
("1.2.3+build", "1.2.3+build");
(" v1.2.3+build", "1.2.3+build") ] )
https://gitlab.com/irill/dose3/-/blob/master/src/versioning/tests/tests.ml?ref_type=heads#L152
While investigating a new build failure of dose3 in Debian, I bumped into this issue and we are affected.
Cross-reference: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1081360
This was broken by #233. Re.Pcre.(split ~rex:(regexp "[.]")) "" now returns [""] when it should return the empty list.
Hello, do we have any fix for this?
This is not fixed in 1.13.3: https://github.com/ocaml/ocaml-re/issues/584