question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Wrong Order in Substitution Resolution Leads to Faulty Configuration

See original GitHub issue

The substitution resolution is not performed in the order of the HOCON variable assignment.

Version: 0.3.58

Example:

pyhocon -i <INPUT_FILE>

Input file:

common = common
original = ${common}/original
result = ${original}
replaced = ${common}/replaced
result = ${replaced}
copy = ${result}

Result:

{
  "common": "common",
  "original": "common/original",
  "result": "common/replaced",
  "replaced": "common/replaced",
  "copy": "common/original"
}

Expected Result:

{
  "common": "common",
  "original": "common/original",
  "result": "common/replaced",
  "replaced": "common/replaced",
  "copy": "common/replaced"
}

Analyzing the substitution process, we see that the substitution is performed in the following order:

  1. ${common} -> original = common/original
  2. ${original} -> result = common/original
  3. ${replaced} -> result = ${replaced} (HOWEVER: cannot be resolved because ${replaced} contains a substitution itself, thus the previous resolution stays for now! Here lies the issue!)
  4. ${common} -> replaced = common/replaced
  5. ${result} -> copy = common/original (Because the result = ${replaced} substitution could not be done until now, this apparently takes the previous substitution)

Now the next substitution iteration starts with the single left over substitution:

  1. ${replaced} -> result = common/replaced

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
afanasevcommented, May 19, 2022

Hi! I’ve created test based on your test data and managed to fix it and not break any other tests: https://github.com/chimpler/pyhocon/pull/284

0reactions
afanasevcommented, May 27, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

Customizing resolution of a dependency directly
However, tasks to build the replaced dependency will not be executed in order to resolve the depending Configuration . Conditionally substituting a dependency....
Read more >
Substitution failure is not an error - Wikipedia
Substitution failure is not an error (SFINAE) refers to a situation in C++ where an invalid substitution of template parameters is not in...
Read more >
c++ - what is the order of the function template instantiation ...
both templates will be instantiated but overload resolution will fail as the two functions void test(anonymous struct, int) are ambiguous.
Read more >
"The Delegates settings were not saved correctly" error when ...
Resolution. Outlook can be configured to enable you to add delegates without requiring you to grant the "send on behalf of" permission. Follow...
Read more >
Common TypeScript module problems and how to solve them
Enabling the compiler module resolution tracing in TypeScript can ... configuration, TypeScript compiler will throw the following error:
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found