engine: resources: Detect simple self-referential frags
It would be a likely mistake to create a self-referential frag, and mgmt would spin forever updating the file... We probably don't want this, so let's just catch this case in Validate. Of course you could get around this with multiple files, and a fancier search could statically check the graph, but the goal isn't to prevent any bad code, since that's not likely to be possible.
This commit is contained in:
16
lang/interpret_test/TestAstFunc3/frag1.txtar
Normal file
16
lang/interpret_test/TestAstFunc3/frag1.txtar
Normal file
@@ -0,0 +1,16 @@
|
||||
-- main.mcl --
|
||||
file "/tmp/frags/" {
|
||||
state => "exists",
|
||||
}
|
||||
file "/tmp/frags/f1" {
|
||||
state => "exists",
|
||||
content => "f1 contents\n",
|
||||
}
|
||||
file "/tmp/frags/all" {
|
||||
state => "exists",
|
||||
fragments => [
|
||||
"/tmp/frags/",
|
||||
],
|
||||
}
|
||||
-- OUTPUT --
|
||||
# err: errValidate: file[/tmp/frags/all] did not Validate: inside a frag (`/tmp/frags/`)
|
||||
Reference in New Issue
Block a user