wesnoth icon indicating copy to clipboard operation
wesnoth copied to clipboard

stderr produces spam when help opened in game

Open MXB2001 opened this issue 4 years ago • 6 comments

Game and System Information

  • What version of the game are you running? 1.16.1
  • Where did you download it from? (Steam, Mac App Store, our website, built from source, etc.) flatpak
  • What OS are you running? Debian Linux

Describe the bug

When help is accessed in game the stderr is filled with a HUGE list of unknown unit types (see edited extract below)

To Reproduce

Run a MP game (maybe campaign too) using user addon era. Open unit help while in game. Observe spam in log.

Expected behavior

No spam

Additional context

Battle for Wesnoth v1.16.1 x86_64 Started on Thu Dec 30 15:51:16 2021

Data directory: /app/share/wesnoth User configuration directory: /home/USER/.var/app/org.wesnoth.Wesnoth/config/wesnoth User data directory: /home/USER/.var/app/org.wesnoth.Wesnoth/data/wesnoth/1.16 Cache directory: /home/USER/.var/app/org.wesnoth.Wesnoth/cache/wesnoth

20211230 15:51:16 warning general: setlocale() failed for 'de_DE'. 20211230 15:51:16 warning general: setlocale() failed for 'de_DE'. Setting mode to 1280x1024 Checking lua scripts... ok Unknown unit type : AoT Saurian Ambusher Unknown unit type : AoT Saurian Oracle Unknown unit type : AoT Saurian Soothsayer Unknown unit type : AoT_saurian_beastmaster Unknown unit type : AoT_saurian_sorcerer Unknown unit type : AoT_saurian_profaner Unknown unit type : AoT Naga Fighter Unknown unit type : AoT Naga Guardian Unknown unit type : AoT Naga Hunter Unknown unit type : AoT Saurian Augur Unknown unit type : AoT Saurian Skirmisher Unknown unit type : AoT_saurian_tamer Unknown unit type : AoT_saurian_scout Unknown unit type : AoT_saurian_warlock Unknown unit type : AoT_guard Unknown unit type : AoT_commander Unknown unit type : AoT_crossbowman Unknown unit type : AoT_justice Unknown unit type : AoT_adept Unknown unit type : AoT_infantryman Unknown unit type : AoT_trooper Unknown unit type : AoT_apothecary Unknown unit type : AoT_scoutcavalry Unknown unit type : AoT_judge Unknown unit type : AoT_acolyte Unknown unit type : AoT_shoreguard Unknown unit type : AoT_kadori_vanquisher Unknown unit type : AoT_kadori_ravager Unknown unit type : AoT_kadori_stalker Unknown unit type : AoT_kadori_seer Unknown unit type : AoT_kadori_doomsayer Unknown unit type : AoT_kadori_warrior Unknown unit type : AoT_kadori_raider Unknown unit type : AoT_kadori_tracker Unknown unit type : AoT_kadori_soothsayer Unknown unit type : AoT_djinni Unknown unit type : AoT_salamander Unknown unit type : AoT_hound Unknown unit type : AoT_aristocrat Unknown unit type : AoT_tactician Unknown unit type : AoT_veteran Unknown unit type : AoT_gunner Unknown unit type : AoT_grenadier Unknown unit type : AoT_peer Unknown unit type : AoT_rifleman Unknown unit type : AoT_ranger Unknown unit type : AoT_alchemist Unknown unit type : AoT_seeker Unknown unit type : AoT_mechanoid Unknown unit type : AoT_diver Unknown unit type : AoT_firebrand Unknown unit type : AoT_rioter Unknown unit type : AoT_outcast Unknown unit type : AoT_prowler Unknown unit type : AoT_malcontent Unknown unit type : AoT_fugitive Unknown unit type : AoT_horsethief Unknown unit type : AoT_sud_reaver

... it goes on to list every custom addon unit installed (1000's).

MXB2001 avatar Dec 30 '21 21:12 MXB2001

I just tried this with a local MP game using Archaic Era, got no errors when accessing the help dialog. Maybe there is a bug in one of the installed Eras? (Using Linux too, but not from flatpak, though I doubt that matters.)

doofus-01 avatar Dec 31 '21 05:12 doofus-01

I've seen this one too, have debugged it and it's a simple fix*. Reproducing the bug requires multiple eras with custom units installed - the help browser then generates topics for each era, but can't find the custom units to link to from the era topics.

It's actually the opposite of #6409, in that finding any unit (in any enabled era) with that id will silence the warning. However, #6409 does solve one of the questions about this code - if it ends up linking to the wrong unit, we should blame both add-ons that have duplicate IDs.

* although a "simple fix", it does raise a question about the preferred C++ coding style for indicating non-fatal errors.

stevecotton avatar Dec 31 '21 11:12 stevecotton

The best fix is probably to add the following method to game_config_manager and use it to influence whether the error message is shown:

/**
 * Returns true if this era is provided by the active addons (or is part of mainline), false otherwise.
 *
 * For an inactive era, the data from the "era" tag itself is still included in game_config_view, but the
 * units from that era won't be.
 */
bool is_active_era(const std::string& id);

stevecotton avatar Feb 13 '23 04:02 stevecotton

Confirmed with 1.17.24.

ProditorMagnus avatar Jan 21 '24 18:01 ProditorMagnus