Project

General

Profile

Actions

Bug #17811

closed

fix nasty random generation failure

Added by Gaëtan POBLON almost 4 years ago. Updated almost 4 years ago.

Status:
Released
Priority:
N/A
Category:
rudderc
Target version:
Severity:
UX impact:
User visibility:
Effort required:
Priority:
0
Name check:
To do
Fix check:
Checked
Regression:

Description

Generation of a technique in rudder-lang randomly failed for no obvious reason.

After investigation it appeared that this bug were exposed by a duplicate variable declaration located in the rudder-lang library.

The bug was hidden in a recursive function whose purpose was to generate the context tree (which is very important to register variables and their relative namespaces).

Duplicates weren't detected properly (recursion had flow flaws), and when they were (if the duplicate was the first entry of the context tree hashmap) it led to a crash.

Investigating this, I noticed another issue: namespaces weren't push right, ie:
```
sys.arch.linux
sys.arch.windows
```
Would led to
Context { arch { windows } }

instead of:
Context { arch { linux, windows } }

Now program behaves properly:
- warns the user when a duplicate is declared
- properly generates the tree regardless of its elements order
- properly pushes nested content
- added tests unit

Actions

Also available in: Atom PDF