Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

rv/rvgen: enforce presence of initial state

The __get_state_variables() method parses DOT files to identify the
automaton's initial state. If the input file lacks a node with the
required initialization prefix, the initial_state variable is referenced
before assignment, causing an UnboundLocalError or a generic error
during the state removal step.

Initialize the variable explicitly and validate that a start node was
found after parsing. Raise a descriptive AutomataError if the definition
is missing to improve debugging and ensure the automaton is valid.

Signed-off-by: Wander Lairson Costa <wander@redhat.com>
Reviewed-by: Gabriele Monaco <gmonaco@redhat.com>
Link: https://lore.kernel.org/r/20260223162407.147003-18-wander@redhat.com
Signed-off-by: Gabriele Monaco <gmonaco@redhat.com>

authored by

Wander Lairson Costa and committed by
Gabriele Monaco
957dcbf0 2074723f

+4
+4
tools/verification/rvgen/rvgen/automata.py
··· 145 145 # wait for node declaration 146 146 states = [] 147 147 final_states = [] 148 + initial_state = "" 148 149 149 150 has_final_states = False 150 151 cursor = self.__get_cursor_begin_states() ··· 171 170 if "ellipse" in line: 172 171 final_states.append(state) 173 172 has_final_states = True 173 + 174 + if not initial_state: 175 + raise AutomataError("The automaton doesn't have an initial state") 174 176 175 177 states = sorted(set(states)) 176 178 states.remove(initial_state)