[Freeciv-tickets] [freeciv] #43724: Segfault with cyclic requirements in self-provided goods

Zurück zum Archiv-Index
OSDN Ticket System norep****@osdn*****
Fri Jan 28 23:48:38 JST 2022


#43724: Segfault with cyclic requirements in self-provided goods

  Open Date: 2022-01-28 15:33
Last Update: 2022-01-28 15:48

URL for this Ticket:
    https://osdn.net//projects/freeciv/ticket/43724
RSS feed for this Ticket:
    https://osdn.net/ticket/ticket_rss.php?group_id=12505&tid=43724

---------------------------------------------------------------------

Last Changes/Comment on this Ticket:
2022-01-28 15:48 Updated by: alienvalkyrie

Comment:

Potential added complexity:
If a ruleset author wants goods that are already mutually exclusive due to other requirements (so the infinite recursion can never happen), but also wants importing one of them to disable the other, e.g.
[goods_wetness]
name = _("Wetness")
reqs =
    { "type",         "name",    "range",    "present"
      "TerrainClass", "Oceanic", "Adjacent", TRUE
      "Good",         "Dryness", "City",     FALSE
    }
flags = "Self-Provided"

[goods_dryness]
name = _("Dryness")
reqs =
    { "type",         "name",    "range",    "present"
      "TerrainClass", "Oceanic", "Adjacent", FALSE
      "Good",         "Wetness", "City",     FALSE
    }
flags = "Self-Provided"
i.e. a city can only export authentic Wetness when it's next to the ocean and doesn't import Dryness, and it can only export authentic Dryness when it's landlocked and doesn't import Wetness.
Allowing this would make load-time sanity checks more complicated.

---------------------------------------------------------------------
Ticket Status:

      Reporter: alienvalkyrie
         Owner: (None)
          Type: Bugs
        Status: Open
      Priority: 5 - Medium
     MileStone: S3_2 d3f
     Component: General
      Severity: 5 - Medium
    Resolution: None
---------------------------------------------------------------------

Ticket details:

With the self-provided goods introduced in #43532, infinite recursion is possible via is_req_active -> is_goods_type_in_range -> goods_can_be_provided -> are_reqs_active -> is_req_active if ruleset authors include cyclic dependencies between self-provided goods. This should probably be caught with sanity checks when loading the ruleset rather than crashing.

-- 
Ticket information of Freeciv project
Freeciv Project is hosted on OSDN

Project URL: https://osdn.net/projects/freeciv/
OSDN: https://osdn.net

URL for this Ticket:
    https://osdn.net/projects/freeciv/ticket/43724
RSS feed for this Ticket:
    https://osdn.net/ticket/ticket_rss.php?group_id=12505&tid=43724



More information about the Freeciv-tickets mailing list
Zurück zum Archiv-Index