bugBattle for Wesnoth - Bugs: bug #20366, Corrupted preferences file should...

Show feedback again

You are not allowed to post comments on this tracker with your current authentification level.

bug #20366: Corrupted preferences file should not prevent Wesnoth startup

Submitted by:  Ignacio R. Morelle <shadowmaster>
Submitted on:  Fri Dec 14 01:23:00 2012  
Category: Feature RequestSeverity: 4 - Important
Priority: 5 - NormalItem Group: User Interface
Status: NonePrivacy: Public
Assigned to: Ignacio R. Morelle <shadowmaster>Open/Closed: Open
Release: 1.10.x, 1.11.0, 1.11.1, trunk r55849Operating System: Any

Sun Feb 10 09:46:23 2013, comment #2:

This FR is quite similar to bug #19970. I'm testing a fix at the moment, if it fails to read the preferences it falls back to the default settings and overwrites the broken preferences upon exit.

I personally feel GUI feedback is overkill so I won't add that, I leave it to you to decide whether my fix is enough or whether you want to keep the FR open for the dialogue.

Mark de Wever <mordante>
Project Member
Fri Dec 14 01:25:07 2012, comment #1:

Alternate method to reproduce (previously hinted at):

- Enter the command :alias =foo=bar in the in-game command line. This inserts a line ="foo=bar" in the preferences file, which is invalid WML.

- Try restarting Wesnoth. stderr should look like this:
(Needless to say, the line number will vary.)

Ignacio R. Morelle <shadowmaster>
Project AdministratorIn charge of this item.
Fri Dec 14 01:23:00 2012, original submission:

When Wesnoth hits a WML parser error when reading the main preferences file, it will instantly quit without any visual indication. The most that it will do in this case is printing the parser error in stderr with the affected file referred to as "<unknown>".

This is a rather severe usability problem that has affected every version I can recall. Ideally, there should be no way for Wesnoth to corrupt its preferences file, but this can not only happen accidentally (filesystem failure, etc.), but also deliberately, such as by entering the command :alias =foo=bar in the in-game command line.

To solve it I would propose ignoring the preferences file every time it exists and can't be read, and warning the user with an in-game notification via GUI dialog with an option to discard the corrupted preferences file and overwrite it, as well as pointers to solve the issue without discarding it.

Since this is not so much a bug as it is missing functionality (a sane fallback and notification in case the preferences file cannot be parsed), I have submitted it as a feature request.

(If nobody wants to try solving this before 1.11.4 or so, I may look into it myself.)

Steps to reproduce:

- Open the preferences file, and insert a '=' character at the beginning so that the first line reads like this:

- Try starting Wesnoth. stderr should look like this:

Ignacio R. Morelle <shadowmaster>
Project AdministratorIn charge of this item.


No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by mordante (Posted a comment)
  • -unavailable- added by shadowmaster (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


    Error: not logged in



    Follows 1 latest change.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon Jun 30 00:17:24 2014shadowmasterAssigned toNone=>shadowmaster
    Show feedback again

    Back to the top

    Powered by Savane 3.1-cleanup