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

fix stop early bug when scanning for watermarks #1423

Merged
2 commits merged into from
Oct 10, 2018
Merged

Conversation

struktured
Copy link

This PR fixes a bug discovered when trying to replace the lengthier watermarks such as PKG_MAINTAINER and VCS_COMMIT_ID. The algorithm searching for substitution candidates stops its search without scanning the remaining string if the length of the accumulated string is larger than the longest watermark key in the replacement map.

However, it failed to account for the initial %% and thus short circuited too soon for longer watermarks. This proposed patch defines a well named constant equal to String.length "%%" and adds its length to the existing check.

@struktured struktured requested a review from a user October 8, 2018 18:23
@rgrinberg
Copy link
Member

Thanks for your contribution. Would you mind reviewing our contribution guide and signing your commit using git? (tl;dr $ git commit --amend -s)

@emillon
Copy link
Collaborator

emillon commented Oct 9, 2018

What does the exception look like? Is this similar to #1182?

@struktured
Copy link
Author

@emillon no exception is thrown, it just never replaces the longer watermarks.

Signed-off-by: Carmelo Piccione <cep1@solvuu.com>
@emillon
Copy link
Collaborator

emillon commented Oct 9, 2018

Ok! Thanks.

@ghost ghost merged commit fe14cfb into ocaml:master Oct 10, 2018
rgrinberg added a commit to rgrinberg/opam-repository that referenced this pull request Oct 10, 2018
CHANGES:

- Do not fail if the output of `ocamlc -config` doesn't include
  `standard_runtime` (ocaml/dune#1326, @diml)

- Let `Configurator.V1.C_define.import` handle negative integers
  (ocaml/dune#1334, @Chris00)

- Re-execute actions when a target is modified by the user inside
  `_build` (ocaml/dune#1343, fix ocaml/dune#1342, @diml)

- Pass `--set-switch` to opam (ocaml/dune#1341, fix ocaml/dune#1337, @diml)

- Fix bad interaction between multi-directory libraries the `menhir`
  stanza (ocaml/dune#1373, fix ocaml/dune#1372, @diml)

- Integration with automatic formatters (ocaml/dune#1252, fix ocaml/dune#1201, @emillon)

- Better error message when using `(self_build_stubs_archive ...)` and
  `(c_names ...)` or `(cxx_names ...)` simultaneously.
  (ocaml/dune#1375, fix ocaml/dune#1306, @nojb)

- Improve name detection for packages when the prefix isn't an actual package
  (ocaml/dune#1361, fix ocaml/dune#1360, @rgrinberg)

- Support for new menhir rules (ocaml/dune#863, fix ocaml/dune#305, @fpottier, @rgrinberg)

- Do not remove flags when compiling compatibility modules for wrapped mode
  (ocaml/dune#1382, fix ocaml/dune#1364, @rgrinberg)

- Fix reason support when using `staged_pps` (ocaml/dune#1384, @charlesetc)

- Add support for `enabled_if` in `rule`, `menhir`, `ocamllex`,
  `ocamlyacc` (ocaml/dune#1387, @diml)

- Exit gracefully when a signal is received (ocaml/dune#1366, @diml)

- Load all defined libraries recursively into utop (ocaml/dune#1384, fix ocaml/dune#1344,
  @rgrinberg)

- Allow to use libraries `bytes`, `result` and `uchar` without `findlib`
  installed (ocaml/dune#1391, @nojb)

- Take argument to self_build_stubs_archive into account. (ocaml/dune#1395, @nojb)

- Fix bad interaction between `env` customization and vendored
  projects: when a vendored project didn't have its own `env` stanza,
  the `env` stanza from the enclosing project was in effect (ocaml/dune#1408,
  @diml)

- Fix stop early bug when scanning for watermarks (ocaml/dune#1423, @diml)
This pull request was closed.
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

4 participants