luanti-org/luanti

More sane error checking for configuration files (in case of duplicate keys)

Open

#12,691 opened on Aug 13, 2022

View on GitHub
 (1 comment) (1 reaction) (0 assignees)C++ (2,395 forks)auto 404
@ Startup / Config / UtilRequest / Suggestiongood first issue

Repository metrics

Stars
 (13,341 stars)
PR merge metrics
 (PR metrics pending)

Description

Problem

I ran into an issue with the world.mt file where there were two lines starting with player_backend. The reason both lines were present was mostly my fault, but it meant that when I changed the top one it would always be reset to the value of the bottom one. The bottom one was buried in the load_mod... lines and I had initially missed it

Until I found that duplicate line I had no idea why it would not accept the sqlite3 db I had when the db wasn't corrupted (the bottom was set to files)

It took me almost all day to find this duplicate line. The server was down all the while.

Solutions

Error and exit if there's a duplicate key with a different value in the world.mt file.

Alternatives

  • Log a red-text warning about this to chat when booting. (The issue is potentially game beaking, like a missing mod dependency is)
  • When editing the file remove the duplicate instead of editing them to match. (Edit: This is my current preferred solution)

Additional context

Issue was debugged in the mt discord. (I'll edit in the link when I'm not on my phone)

Contributor guide