Odd error that occurs only when the textdomain is wesnoth-dl

Having trouble with the game? Report issues and get help here. Read this first!

Moderator: Forum Moderators

Forum rules
Before reporting issues in this section, you must read the following topic:
Post Reply
User avatar
josteph
Inactive Developer
Posts: 741
Joined: August 19th, 2017, 6:58 pm

Odd error that occurs only when the textdomain is wesnoth-dl

Post by josteph »

Konrad2 has run into a peculiar error where all translated strings defined in scenario 1 of a UMC campaigns are reported invalid and replaced by empty strings:
wesnoth-20190107-151203-11096.log
He gets that error when he starts playing The Rulers of Irdya. If he changes the first line of the first scenario from #textdomain wesnoth-dl to #textdomain wesnoth-tsg (that's The South Guard's textdomain), the error goes away. None of his other addons mention wesnoth-dl in any way or have file named wesnoth-dl (po, mo, or anything else). He also tried #textdomain wesnoth-tRoI, that worked yesterday but reproduces the error today. He also tried keeping the textdomain unmodified and removing one or two addons from the ones he has installed (not always the same one or two), that also made the error go away yesterday.

The "invalid string:" errors have some random bytes. For example, one of the invalid strings is "\2tRoI-\4\x81\0The Rising Storm". His savefiles are named tRoI--Auto-Save1.gz, with the scenario name replaced by empty string.
User avatar
josteph
Inactive Developer
Posts: 741
Joined: August 19th, 2017, 6:58 pm

Re: Odd error that occurs only when the textdomain is wesnoth-dl

Post by josteph »

We think it might be caused by a1bbe66acb45a6cfa8cb9f1501f9f6207d1bc192.
User avatar
The_Gnat
Posts: 2215
Joined: October 10th, 2016, 3:06 am
Contact:

Re: Odd error that occurs only when the textdomain is wesnoth-dl

Post by The_Gnat »

Could this error be explained in plain English for other addon creators ^_^ . Also do you think the other addon Dragons Lair with text domain wesnoth-dl needs changing?
User avatar
josteph
Inactive Developer
Posts: 741
Joined: August 19th, 2017, 6:58 pm

Re: Odd error that occurs only when the textdomain is wesnoth-dl

Post by josteph »

The_Gnat wrote: January 7th, 2019, 9:01 pm Could this error be explained in plain English for other addon creators ^_^ .
Sure. In the C++ engine, each textdomain is assigned a numeric id, a nonnegative integer. The id numbers are assigned sequentially. Due to a bug, the addon whose textdomain happened to be assigned id=129 was instead considered to have id=(largest possible integer + 129 - 256). Since that value is (much) larger than the largest id that had been assigned, the string was considered invalid and an error was logged.

That validity check was a safety net that worked as intended. If it hadn't been in place, Wesnoth would have crashed.

The error was platform-dependent (it would only occur on platforms whose char type is signed) and would have affected any addon whose textdomain was >=128.

edit: jyrkive adds, "char is signed on every major platform". (The standard leaves that as implementation-defined but the major platforms all define it the same way.)
The_Gnat wrote: January 7th, 2019, 9:01 pmAlso do you think the other addon Dragons Lair with text domain wesnoth-dl needs changing?
No. The bug was in the C++ side.
User avatar
The_Gnat
Posts: 2215
Joined: October 10th, 2016, 3:06 am
Contact:

Re: Odd error that occurs only when the textdomain is wesnoth-dl

Post by The_Gnat »

josteph wrote: January 7th, 2019, 10:05 pm
The_Gnat wrote: January 7th, 2019, 9:01 pm Could this error be explained in plain English for other addon creators ^_^ .
Sure.
Thank you! That is really good to know. Very interesting error. Also I would like to say thank you for your help identifying the error, I respect your commitment and also ingenuity in finding such a obscure bug. :)
User avatar
josteph
Inactive Developer
Posts: 741
Joined: August 19th, 2017, 6:58 pm

Re: Odd error that occurs only when the textdomain is wesnoth-dl

Post by josteph »

You're welcome. For further information, see "Integral conversions" in https://en.cppreference.com/w/cpp/langu ... conversion.
User avatar
The_Gnat
Posts: 2215
Joined: October 10th, 2016, 3:06 am
Contact:

Re: Odd error that occurs only when the textdomain is wesnoth-dl

Post by The_Gnat »

Yes great I will take a look at that. Also did we ever find out what addon was causing the conflict? Or was it merely the volume of translations installed?
User avatar
josteph
Inactive Developer
Posts: 741
Joined: August 19th, 2017, 6:58 pm

Re: Odd error that occurs only when the textdomain is wesnoth-dl

Post by josteph »

It was just the volume. I could reproduce the problem locally by adding 150 textdomains to AOI, without having more than a few addons installed.
Post Reply