Bug 25313 - gnubg crash (core dumped) if exist ~/.gnubg/gnubgautorc file (Spanish install)
Summary: gnubg crash (core dumped) if exist ~/.gnubg/gnubgautorc file (Spanish install)
Status: RESOLVED FIXED
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: 7
Hardware: x86_64 Linux
Priority: Normal normal
Target Milestone: ---
Assignee: QA Team
QA Contact:
URL:
Whiteboard: has_procedure MGA7-64-OK
Keywords: advisory, validated_update
Depends on:
Blocks:
 
Reported: 2019-08-16 04:42 CEST by Eduardo Mestre
Modified: 2020-04-01 03:58 CEST (History)
7 users (show)

See Also:
Source RPM: gnubg-1.06.002-2.mga7.src.rpm
CVE:
Status comment:


Attachments
User environment settings - english locale (4.53 KB, text/plain)
2020-03-21 19:35 CET, Len Lawrence
Details

Description Eduardo Mestre 2019-08-16 04:42:07 CEST
Description of problem:

[eduardo@metalheart ~]$ gnubg
GNU Backgammon 1.06.002  Sep 12 2018
Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 by Gary Wong.
Copyright (C) 2018 by Gary Wong and the AUTHORS; for details type `show version'.
This program comes with ABSOLUTELY NO WARRANTY; for details type `show warranty'.
This is free software, and you are welcome to redistribute it under certain conditions; type `show copying' for details.
*** buffer overflow detected ***: gnubg terminated
Abortado (`core' generado)
[eduardo@metalheart ~]$ rm -f .gnubg/gnubgautorc
[eduardo@metalheart ~]$ gnubg
GNU Backgammon 1.06.002  Sep 12 2018
Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 by Gary Wong.
Copyright (C) 2018 by Gary Wong and the AUTHORS; for details type `show version'.
This program comes with ABSOLUTELY NO WARRANTY; for details type `show warranty'.
This is free software, and you are welcome to redistribute it under certain conditions; type `show copying' for details.
(No hay juego) set gui showids on
(No hay juego) save settings
(No hay juego) quit

The game works fine.

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1. Open gnubg first time, it works OK
2. Abandon the game, it creates a configuration file
3. Open gnubg another time, then it crashes and core dumped
Comment 1 Lewis Smith 2019-08-16 21:02:16 CEST
Trying to reproduce this - I cannot! After installing gnubg:
 $ rpm -q gnubg
 gnubg-1.06.002-2.mga7
 $ ls -al .gnubg
 ls: cannot access '.gnubg': No such file or directory  [No gnupg files]
Using MATE desktop.

Started it first time, a new match, quit:
 $ gnubg
GNU Backgammon 1.06.002  Sep 12 2018
... as above
(No game) set gui showids on
(No game) save settings
(No game) save settings
(No game) new match 7
(lewis) quit
(lewis) [lewis@localhost ~]$ 

 $ ls -alR .gnubg            [Yes, it did create its files]
.gnubg:
total 84
drwx------  3 lewis lewis  4096 Aws  16 20:37 ./
drwxr-x--- 28 lewis lewis  4096 Aws  16 20:36 ../
drwx------  2 lewis lewis  4096 Aws  16 20:36 backup/
-rw-rw-r--  1 lewis lewis 60279 Aws  16 20:36 gnubgautorc       *****
-rw-r--r--  1 lewis lewis  5892 Aws  16 20:36 gnubgmenurc
-rw-------  1 lewis lewis    64 Aws  16 20:37 history
.gnubg/backup:
total 8
drwx------ 2 lewis lewis 4096 Aws  16 20:36 ./
drwx------ 3 lewis lewis 4096 Aws  16 20:37 ../

Start another new match, then quit:
 $ gnubg
GNU Backgammon 1.06.002  Sep 12 2018
... as above
(No game) set gui showids on
(No game) save settings
(No game) save settings
(No game) new match 7
(lewis) quit
(lewis) [lewis@localhost ~]$              [NO crash!]

@Eduardo Can you please say:
- What Mageia 7 ISO you installed from;
- What Desktop you are using.            [I can try with the same one]
I think the fact that I saw 'Save settings' twice was due to starting a new match after launching the program.

CC: (none) => lewyssmith
Whiteboard: (none) => NEEDINFO

Comment 2 Marja Van Waes 2019-08-17 07:33:44 CEST
Thanks for your questions for Eduardo, who'll hopefully reply soon, and for having tried to reproduce it, Lewis.

I'm also wondering whether the issue could depend on the used language (Spanish for the reporter).

CC'ing our registered gnubg maintainer, in case this report already rings a bell.

CC: (none) => dan, marja11
Summary: gnubg crash (core dumped) if exist ~/.gnubg/gnubgautorc file => gnubg crash (core dumped) if exist ~/.gnubg/gnubgautorc file (Spanish install)

Comment 3 Eduardo Mestre 2019-08-17 18:43:27 CEST
(In reply to Lewis Smith from comment #1)
> Trying to reproduce this - I cannot! After installing gnubg:
>  $ rpm -q gnubg
>  gnubg-1.06.002-2.mga7
>  $ ls -al .gnubg
>  ls: cannot access '.gnubg': No such file or directory  [No gnupg files]
> Using MATE desktop.
> 
> Started it first time, a new match, quit:
>  $ gnubg
> GNU Backgammon 1.06.002  Sep 12 2018
> ... as above
> (No game) set gui showids on
> (No game) save settings
> (No game) save settings
> (No game) new match 7
> (lewis) quit
> (lewis) [lewis@localhost ~]$ 
> 
>  $ ls -alR .gnubg            [Yes, it did create its files]
> .gnubg:
> total 84
> drwx------  3 lewis lewis  4096 Aws  16 20:37 ./
> drwxr-x--- 28 lewis lewis  4096 Aws  16 20:36 ../
> drwx------  2 lewis lewis  4096 Aws  16 20:36 backup/
> -rw-rw-r--  1 lewis lewis 60279 Aws  16 20:36 gnubgautorc       *****
> -rw-r--r--  1 lewis lewis  5892 Aws  16 20:36 gnubgmenurc
> -rw-------  1 lewis lewis    64 Aws  16 20:37 history
> .gnubg/backup:
> total 8
> drwx------ 2 lewis lewis 4096 Aws  16 20:36 ./
> drwx------ 3 lewis lewis 4096 Aws  16 20:37 ../
> 
> Start another new match, then quit:
>  $ gnubg
> GNU Backgammon 1.06.002  Sep 12 2018
> ... as above
> (No game) set gui showids on
> (No game) save settings
> (No game) save settings
> (No game) new match 7
> (lewis) quit
> (lewis) [lewis@localhost ~]$              [NO crash!]
> 
> @Eduardo Can you please say:
> - What Mageia 7 ISO you installed from;
> - What Desktop you are using.            [I can try with the same one]
> I think the fact that I saw 'Save settings' twice was due to starting a new
> match after launching the program.

I upgrade online from Mageia 6 and in a virtualbox DVD classic instalation. Mate, KDE/Plasma and Gnome.

I don't understand the last sentence. I need always remove .gnubg/gnubgautorc file to open gnubg.
Comment 4 Marja Van Waes 2019-08-24 18:27:33 CEST
@ danf

Assigning to you, anyway, since BugSquad lacks time to try to get more details. Sorry about that!

Whiteboard: NEEDINFO => (none)
Assignee: bugsquad => dan

Comment 5 katnatek 2019-08-27 22:49:45 CEST
I reproduce this bug, in MGA 7 (upgraded from MGA 6) i586 Xfce

First time (works)

gnubg 
GNU Backgammon 1.06.002  Sep 12 2018
Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 by Gary Wong.
Copyright (C) 2018 by Gary Wong and the AUTHORS; for details type `show version'.
This program comes with ABSOLUTELY NO WARRANTY; for details type `show warranty'.
This is free software, and you are welcome to redistribute it under certain conditions; type `show copying' for details.
Fontconfig warning: ignoring LC_CTYPE=es_MX.UTF-8;LC_NUMERIC=es_MX.UTF-8;LC_TIME=es_MX.UTF-8;LC_COLLATE=es_MX.UTF-8;LC_MONETARY=es_MX.UTF-8;LC_MESSAGES=es_MX.utf8;LC_PAPER=es_MX.UTF-8;LC_NAME=es_MX.UTF-8;LC_ADDRESS=es_MX.UTF-8;LC_TELEPHONE=es_MX.UTF-8;LC_MEASUREMENT=es_MX.UTF-8;LC_IDENTIFICATION=es_MX.UTF-8: not a valid region tag
(No hay juego) set gui showids on
(No hay juego) save settings
(No hay juego) 

Second Time (Fail)

gnubg 
GNU Backgammon 1.06.002  Sep 12 2018
Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 by Gary Wong.
Copyright (C) 2018 by Gary Wong and the AUTHORS; for details type `show version'.
This program comes with ABSOLUTELY NO WARRANTY; for details type `show warranty'.
This is free software, and you are welcome to redistribute it under certain conditions; type `show copying' for details.
Fontconfig warning: ignoring LC_CTYPE=es_MX.UTF-8;LC_NUMERIC=es_MX.UTF-8;LC_TIME=es_MX.UTF-8;LC_COLLATE=es_MX.UTF-8;LC_MONETARY=es_MX.UTF-8;LC_MESSAGES=es_MX.utf8;LC_PAPER=es_MX.UTF-8;LC_NAME=es_MX.UTF-8;LC_ADDRESS=es_MX.UTF-8;LC_TELEPHONE=es_MX.UTF-8;LC_MEASUREMENT=es_MX.UTF-8;LC_IDENTIFICATION=es_MX.UTF-8: not a valid region tag
*** buffer overflow detected ***: gnubg terminated
Abortado (`core' generado)

Third time

LC_ALL=C gnubg (Works)
GNU Backgammon 1.06.002  Sep 12 2018
Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 by Gary Wong.
Copyright (C) 2018 by Gary Wong and the AUTHORS; for details type `show version'.
This program comes with ABSOLUTELY NO WARRANTY; for details type `show warranty'.
This is free software, and you are welcome to redistribute it under certain conditions; type `show copying' for details.
(No game) set gui showids on
(No game) save settings
(No game) 

As the user report in blogdrake (http://blogdrake.net/node/26767) is a issue for spanish locales
Comment 6 Dan Fandrich 2020-03-20 01:44:28 CET
This problem is fixed in gnubg-1.06.002-2.1.mga7 in updates_testing, as well as gnubg-1.06.002-6.mga8 in Cauldron.

For QA testers: the crash can be seen in the old version with this command:

LANGUAGE=es gnubg

which will result in the program crashing with this message:

*** buffer overflow detected ***: gnubg terminated
Aborted (core dumped)

The fixed version will run the game normally in Spanish with that command.

Here's a suggested text for an update advisory:

A bug that caused GNU Backgammon to crash on startup when the Spanish language was in use has been fixed.

Assignee: dan => qa-bugs
Whiteboard: (none) => has_procedure
Status: NEW => ASSIGNED

Comment 7 Len Lawrence 2020-03-21 17:33:44 CET
Unable to reproduce this for the core release version gnubg-1.06.002-2.mga7'

$ LANGUAGE=es gnubg
GNU Backgammon 1.06.002  Sep 12 2018
Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 by Gary Wong.
Copyright (C) 2018 by Gary Wong and the AUTHORS; for details type `show version'.
....
<The backgammon board appears - looks normal>
$ ls .gnubg
backup/  gnubgautorc  gnubgmenurc  history
$ LANGUAGE=es gnubg
GNU Backgammon 1.06.002  Sep 12 2018
Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 by Gary Wong.
....
(No game) set gui showids on
(No game) save settings
(No game)

It works every time, with or without locale specification, in an English environment.  Do you have to start with a Spanish environment?

CC: (none) => tarazed25

Comment 8 Dan Fandrich 2020-03-21 18:30:36 CET
I was able to reproduce the problem with that command-line from an English locale. However, I do have locales-es-2.29-3.mga7 installed on this system. Perhaps it's necessary to have that installed as well?
Comment 9 Len Lawrence 2020-03-21 19:34:04 CET
This is very strange.
$ rm -rf .gnubg

After installing locales-es and logging out and in: 
$ LANGUAGE=es gnubg
OK, configuration files created.
$ LANGUAGE=es gnubg
Still OK.

There must be some other variable as well.  I am appending a copy of printenv output just in case it might be of use.  Too much information really.
Comment 10 Len Lawrence 2020-03-21 19:35:21 CET
Created attachment 11561 [details]
User environment settings - english locale
Comment 11 Dan Fandrich 2020-03-21 19:49:51 CET
Is the UI showing in Spanish for you when you run that? The buffer overflow happens when Spanish text is copied into a too-small buffer, so if it's in Spanish, the buffer overflow will be happening. It could be that the problem is only detected at run-time in x86_64 and therefore you it doesn't result in a crash on i586. You could try installing valgrind and running "LANGUAGE=es valgrind /usr/bin/gnubg" and see if that shows the problem. valgrind shows a couple of problems on exit even on a patched gnubg, so you can ignore those; a problem would cause a crash before the UI is even displayed.
Comment 12 Len Lawrence 2020-03-22 01:34:43 CET
No, the UI appears in English, which was already a sign that there is more to changing the locale than I know.  Running under valgrind did not expose any fault  regarding buffer overrun so I shall have to look into this locale business first.      Tomorrow I guess.
Comment 13 Len Lawrence 2020-03-22 02:59:15 CET
Tried drakconf (MCC) managing locale settings, logged out and selected European Spanish from the drop-down menu and logged in.  Nada, everything in English still, including the backgammon UI.  This is a tough nut to crack - googling reveals that other Mageia users have had trouble with it.  It is certainly something that QA should be able to do in general.
$ rpm -qa | grep -e locale -e l10n
kate-l10n-common-19.04.0-1.mga7
locales-en-2.29-3.mga7
locales-2.29-3.mga7
lib64boost_locale1.68.0-1.68.0-4.mga7
locales-es-2.29-3.mga7

$ export LANGUAGE="es_ES.UTF-8"
$ export LC_ALL=
$ gnubg

No help and nothing in the settings menu for language.
The gnubgautorc file starts with 'set lang system' and recommends using gnubgrc to add settings.

This has no effect on the language used:
$ gnubg --lang="es_ES.UTF-8"
Nor:
$ gnubg --lang=es

Creating a gnubgrc file with the entry:
set lang es_ES.UTF-8
successfully modifies the gnubgautorc file when gnubg is run but does not affect the UI on first or subsequent invocations.
Comment 14 Len Lawrence 2020-03-22 03:43:48 CET
Correction - using utf8 encodings.  .UTF-8 was being rejected by the C library.
Experimented with US Spanish as well.  Nothing "takes".
Comment 15 Len Lawrence 2020-03-22 13:15:45 CET
Should have said that all this has been done on an x86_64 machine.
Using Plasma rather than Mate makes no difference - there was a small chance that KDE might handle locales better, but no.

MageiaWelcome does come up entirely in Spanish without any prompting.

Back in Mate, locale set as es_ES.utf8, the desktop is still English and running gnubg with language es still shows English.

Just as an experiment, with the Spanish locale set, tried a local build of gnubg and installed it.  Now that launches in Spanish but is no use as a test because  the build repository supplies the updated version (don't know how to extract previous version - forgotten actually) and in any case is a private build.  What it does seem to show is that locales cannot be set reliably on the fly.  They work in the build environment but not for already packaged applications in another language, like English.  And all that is irrelevant to the  bug.  More like a problem with i18n or something else.

I think QA is going to have to push this without the reproducer once the update is tested.  ?
Comment 16 Dan Fandrich 2020-03-22 15:16:48 CET
Are the Spanish translations actually installed in your system? urpmi won't normally install translations for languages that you didn't enable during install. Does "ls -l /usr/share/locale/es/LC_MESSAGES/gnubg.mo' Show the file?
Comment 17 Lewis Smith 2020-03-22 17:10:06 CET
This is the n'th Spanish-related bug we have, and we are not alone. Despite the apparent irrelevence of what follows, it *has* been known to fix similar obscure issues:
 $ urpmi ibus-gtk
No harm if it does nothing. Do not know whether you need to re-boot for it to apply. I would.
Comment 18 Dan Fandrich 2020-03-22 17:36:21 CET
It looks like the installed languages is taken from %_install_langs in /etc/rpm/macros
Comment 19 Len Lawrence 2020-03-22 20:24:30 CET
@Dan, comment 16
$ ls -l /usr/share/locale/es/LC_MESSAGES/gnubg.mo
-rw-r--r-- 1 root root 183289 ago  2  2018 /usr/share/locale/es/LC_MESSAGES/gnubg.mo

As to enabling languages at installation time - I did not know it was possible to  build a multilingual system.  I just select British English.  I shall keep a closer eye on choices when setting up the workstation.

@Lewis, comment 17.
Not all that irrelevant...
"The Intelligent Input Bus (IBus) is an input method framework for multilingual input in Unix-like operating systems. It's called "Bus" because it has a bus-like architecture. You can use IBus to type in your own language in most GUI applications."
Comment 20 Len Lawrence 2020-03-22 20:35:21 CET
Yes, ibus-gtk was already installed.
Comment 21 Len Lawrence 2020-03-25 07:25:18 CET
Revisiting this.
Cleared out gnubg related files and reinstalled from Core Release.
$ rpm -qa | grep gnubg
gnubg-1.06.002-2.mga7
lcl@difda:~ $ ll .gnubg
total 76
drwx------ 2 lcl lcl  4096 mar 22 11:30 backup/
-rw-r--r-- 1 lcl lcl 60275 mar 22 11:50 gnubgautorc
-rw-r--r-- 1 lcl lcl  5892 mar 22 11:50 gnubgmenurc
-rw------- 1 lcl lcl   198 mar 22 11:51 history
$ rm -rf .gnubg

$ LANG=es gnubg
GNU Backgammon 1.06.002  Sep 12 2018
[...]
(No hay juego) set gui showids on
(No hay juego) save settings
(No hay juego) 

Reprise:
$ LANG=es gnubg
GNU Backgammon 1.06.002  Sep 12 2018
[...]
*** buffer overflow detected ***: gnubg terminated
Aborted (core dumped)

Bug is reproduced.  

Updated gnubg from Testing.
$ rm -rf .gnubg
$ LANG=es gnubg
<Worked OK - UI in Spanish>
(No hay juego) set gui showids on
(No hay juego) save settings
(No hay juego) $
$ LANG=es gnubg 
<Still works as expected>

Whiteboard: has_procedure => has_procedure MGA7-64-OK

Comment 22 Dan Fandrich 2020-03-25 16:06:52 CET
Thanks for the perseverance!
Comment 23 Thomas Andrews 2020-03-25 16:22:17 CET
Validating.

CC: (none) => andrewsfarm, sysadmin-bugs
Keywords: (none) => validated_update

Dave Hodgins 2020-03-31 23:50:13 CEST

CC: (none) => davidwhodgins
Keywords: (none) => advisory

Comment 24 Mageia Robot 2020-04-01 03:58:10 CEST
An update for this issue has been pushed to the Mageia Updates repository.

https://advisories.mageia.org/MGAA-2020-0084.html

Resolution: (none) => FIXED
Status: ASSIGNED => RESOLVED


Note You need to log in before you can comment on or make changes to this bug.