Opened 5 years ago

Closed 3 years ago

#5576 closed defect (worksforme)

data files not found and Shader segfault on Fedora 29

Reported by: bioinfornatics@… Owned by:
Priority: Must Have Milestone:
Component: Core engine Keywords:
Cc: Patch:

Description

Dear,

when I try to open pyrogenesis I got a segfault

$ /usr/bin/pyrogenesis
TIMER| InitVfs: 972.649 us
Writing the mainlog at /home/jmercier/.config/0ad/logs/mainlog.html
TIMER| CONFIG_Init: 189.966 us
Sound: AlcInit success, using OpenAL Soft
ERROR: CVFSFile: file audio/sound_group.rng couldn't be opened (vfs_load: -110100)
ERROR: CXeromyces: failed adding validator for 'audio/sound_group.rng'
ERROR: CSoundManager: failed to load grammar file 'audio/sound_group.rng'
WARNING: Window icon not found.
ERROR: CVFSFile: file hwdetect/hwdetect.js couldn't be opened (vfs_load: -110100)
ERROR: Failed to load hardware detection script
TIMER| RunHardwareDetection: 3.77789 ms
TIMER| write_sys_info: 29.2919 ms
ERROR: CVFSFile: file gui/gui_page.rng couldn't be opened (vfs_load: -110100)
ERROR: CXeromyces: failed adding validator for 'gui/gui_page.rng'
ERROR: CGUIManager: failed to load GUI page grammar file 'gui/gui_page.rng'
ERROR: CVFSFile: file gui/gui.rng couldn't be opened (vfs_load: -110100)
ERROR: CXeromyces: failed adding validator for 'gui/gui.rng'
ERROR: CGUIManager: failed to load GUI XML grammar file 'gui/gui.rng'
ERROR: CVFSFile: file shaders/program.rng couldn't be opened (vfs_load: -110100)
ERROR: CXeromyces: failed adding validator for 'shaders/program.rng'
ERROR: CShaderManager: failed to load grammar shaders/program.rng
TIMER| InitRenderer: 6.8483 ms
ERROR: Failed to open font file fonts/mono-10.fnt
ERROR: Failed to open font file fonts/sans-10.fnt
TIMER| ps_console: 63.577 us
TIMER| ps_lang_hotkeys: 631.214 us
ERROR: CCacheLoader failed to find archived or source file for: "gui/page_pregame.xml"
ERROR: Failed to open font file fonts/mono-stroke-10.fnt
ERROR: CCacheLoader failed to find archived or source file for: "shaders/effects/gui_text.xml"
ERROR: Failed to load effect 'gui_text'
Segmentation fault (core dumped)

So I used gdb to identify where is the problem

$ gdb /usr/bin/pyrogenesis
GNU gdb (GDB) Fedora 8.2-7.fc29
...
(gdb) b CShaderTechnique::BeginPass
Breakpoint 1 at 0x7bf4e0: file ../../../source/graphics/ShaderTechnique.cpp, line 133.
(gdb) r
(gdb) info args
this = 0x0
pass = 0
(gdb) l
128	{
129		return m_Passes.size();
130	}
131	
132	void CShaderTechnique::BeginPass(int pass)
133	{
134		ENSURE(0 <= pass && pass < (int)m_Passes.size());
135		m_Passes[pass].Bind();
136	}
137	
(gdb) p m_Passes.size()
Python Exception <class 'gdb.MemoryError'> Cannot access memory at address 0x8: 
Error while executing Python code.
(gdb) bt
#0  0x00000000007bf508 in CShaderTechnique::BeginPass (this=0x0, pass=0)
    at ../../../source/graphics/ShaderTechnique.cpp:134
#1  0x000000000063e5c4 in CLogger::Render (this=0xc3f480)
    at /usr/include/c++/8/bits/shared_ptr_base.h:998
#2  0x0000000000676b3f in Render () at ../../../source/ps/GameSetup/GameSetup.cpp:258
#3  0x0000000000481a7d in Frame () at ../../../source/main.cpp:414
#4  0x0000000000484fed in RunGameOrAtlas (argc=<optimized out>, argv=<optimized out>)
    at ../../../source/main.cpp:634
#5  0x000000000047266b in main (argc=1, argv=0x7fffffffd668) at ../../../source/main.cpp:680

on fedora mods file are stored into a zip archive located at: /usr/share/0ad/mods/mod/mod.zip

I even unziped this file into /usr/share/0ad/mods/mod/ but I got the same error any help are welcome

thanks

Change History (13)

comment:1 by elexis, 5 years ago

It complains that it can't find a lot if not all of the data files. Are you sure those are installed? https://trac.wildfiregames.com/wiki/GameDataPaths

comment:2 by bioinfornatics@…, 5 years ago

Ok so if I have not missed an information 0AD try to read data only from ~/.local/share/0ad/ on linux.

If yes, could you update the rule in order to follow tho FHS (file Hierarchy Systen)

1/ data dir rules:

if ~/.local/share/0ad/ exists
  datadir=~/.local/share/0ad/
else: # handle custom prefix (such as /usr/local and /opt/0ad) or system prefix (/usr)
  bindir = dirname pyrogenesis
  datadir = realpath of bindir/../share/0ad
fi

2/ conf dir rules:

if ~/.config/0ad/ exists
  confdir=~/.config/0ad/
else: 
  bindir = dirname pyrogenesis
  if bindir == /usr # handle  system prefix (/usr)
    confdir = /etc/0ad
  else: # handle custom prefix (such as /usr/local and /opt/0ad)
    confdir = realpath of bindir/../etc/0ad
  fi
fi

thanks

comment:3 by elexis, 5 years ago

on fedora mods file are stored into a zip archive located at: /usr/share/0ad/mods/mod/mod.zip

At least some of the files are in public.zip

in reply to:  3 comment:4 by bioinfornatics@…, 5 years ago

Replying to elexis:

on fedora mods file are stored into a zip archive located at: /usr/share/0ad/mods/mod/mod.zip

At least some of the files are in public.zip

yes

$ locate public.zip
/usr/share/0ad/mods/public/public.zip

comment:5 by elexis, 5 years ago

GameSetup.cpp: https://code.wildfiregames.com/source/0ad/browse/ps/trunk/source/ps/GameSetup/GameSetup.cpp

const OsPath xdgData   = XDG_Path("XDG_DATA_HOME",   home, home/".local/share/") / subdirectoryName;

Paths.cpp: https://code.wildfiregames.com/source/0ad/browse/ps/trunk/source/ps/GameSetup/Paths.cpp

const char* path = getenv(envname);

/use/include/stdlib.h:

/* Return the value of envariable NAME, or NULL if it doesn't exist.  */
extern char *getenv (const char *__name) __THROW __nonnull ((1)) __wur;

So it seems the environment variables need to be fixed on the Fedora system?

Did you download and build the source from our repository or obtain the copy from the Fedora package manager? https://fedoraproject.org/wiki/Package_management_system

Last edited 5 years ago by elexis (previous) (diff)

comment:6 by elexis, 5 years ago

Summary: /usr/bin/pyrogenesis segfault on fedoradata files not found and Shader segfault on Fedora 29

comment:7 by bioinfornatics@…, 5 years ago

I obtain the copy from the rpm provided by fedora. I am the co-maitainer of this rpm.

I do not know a linux distribution using the env var XDG_DATA_HOME

Fedora

$ lsb_release -a
LSB Version:    :core-4.1-amd64:core-4.1-noarch
Distributor ID: Fedora
Description:    Fedora release 29 (Twenty Nine)
Release:        29
Codename:       TwentyNine
$ echo $XDG_DATA_HOME

$

Centos

$ lsb_release -a
LSB Version:    :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch
Distributor ID: CentOS
Description:    CentOS Linux release 7.6.1810 (Core)
Release:        7.6.1810
Codename:       Core
$ echo $XDG_DATA_HOME

$

Moreover, 0ad try to write into the Data dir which should not be allowed as the data is owned by the system (root) and the application run as an user so that fail:

$ XDG_DATA_HOME=/usr//share/ pyrogenesis
CreateDirectories: failed to mkdir /usr//share/0ad/mods/user (mode 448)
file_system.cpp(158): Function call failed: return value was -110300 (Insufficient access rights to open file)
Function call failed: return value was -110300 (Insufficient access rights to open file)
Location: file_system.cpp:158 (CreateDirectories)

Call stack:

(0x9d5afe) pyrogenesis() [0x9d5afe]
(0x985491) pyrogenesis() [0x985491]
(0x986822) pyrogenesis() [0x986822]
(0x986bf9) pyrogenesis() [0x986bf9]
(0x994761) pyrogenesis() [0x994761]
(0x994bc2) pyrogenesis() [0x994bc2]
(0x9a7cf8) pyrogenesis() [0x9a7cf8]
(0x678f58) pyrogenesis() [0x678f58]
(0x67f423) pyrogenesis() [0x67f423]
(0x484d17) pyrogenesis() [0x484d17]
(0x47266b) pyrogenesis() [0x47266b]
(0x7f34d3274413) /lib64/libc.so.6(__libc_start_main+0xf3) [0x7f34d3274413]
(0x47fcfe) pyrogenesis() [0x47fcfe]

errno = 0 (Insufficient access rights to open file)
OS error = ?

I think if some files need to be used/read/consumed at runtime this data should be extracted to /var/vache directory or ~/.cache/0ad ( the last choice should be the better one)

http://www.pathname.com/fhs/pub/fhs-2.3.html#VARCACHEAPPLICATIONCACHEDATA

Last edited 5 years ago by bioinfornatics@… (previous) (diff)

comment:8 by bioinfornatics@…, 5 years ago

Hi

Did you think that the patch below will fex the problem on linux. The patch set data dir following the FHS http://www.pathname.com/fhs/2.2/fhs-4.11.html

Index: source/ps/GameSetup/Paths.cpp
===================================================================
--- source/ps/GameSetup/Paths.cpp	(révision 22806)
+++ source/ps/GameSetup/Paths.cpp	(copie de travail)
@@ -142,8 +142,11 @@
 		const OsPath xdgCache  = XDG_Path("XDG_CACHE_HOME",  home, home/".cache/"      ) / subdirectoryName;
 
 		// We don't make the game vs. user data distinction on Unix
-		m_gameData = xdgData/"";
-		m_userData = m_gameData;
+		if ( m_root.Parent() == home )
+		    m_gameData = xdgData/"";
+		else
+            m_gameData = m_root / "share" / "0ad" / "";
+		m_userData = xdgData;
 		m_cache  = xdgCache/"";
 		m_config = xdgConfig / "config"/"";
 		m_logs   = xdgConfig / "logs"/"";

comment:9 by elexis, 5 years ago

Milestone: BacklogAlpha 24
Priority: Should HaveMust Have

comment:10 by s0600204, 5 years ago

With due respect, I'm going to stop you there, because I think you've gone off track.

Firstly: the path stored within m_gameData must be user-writable. This is made clear in the comments in the accompanying header file - Paths.h - which is literally right next to this file in the directory.

The member attribute you should be paying attention to is m_rdata. This is what pyrogenesis (the game engine powering 0ad) uses to find the data that is supplied with the game.


Are you using the same F29 build script that can be found here, or are you using the master branch version of that script, or something else?

If either of the first two options, what does %{_datadir} resolve to? (And I don't mean what should it resolve to, I mean what does it actually resolve to.)

in reply to:  10 comment:11 by bioinfornatics@…, 5 years ago

Thanks s0600204,

Replying to s0600204:

With due respect, I'm going to stop you there, because I think you've gone off track.

Firstly: the path stored within m_gameData must be user-writable. This is made clear in the comments in the accompanying header file - Paths.h - which is literally right next to this file in the directory.

The member attribute you should be paying attention to is m_rdata. This is what pyrogenesis (the game engine powering 0ad) uses to find the data that is supplied with the game.

You are right, I used the wrong variable


Are you using the same F29 build script that can be found here, or are you using the master branch version of that script, or something else?

yes it is this one

If either of the first two options, what does %{_datadir} resolve to? (And I don't mean what should it resolve to, I mean what does it actually resolve to.)

%{_datadir} is a macro which is $DESTDIR/$PREFIX/share which means for end user it is /usr/share

comment:12 by Stan, 4 years ago

What's the status of this?

comment:13 by Stan, 3 years ago

Milestone: Alpha 24
Resolution: worksforme
Status: newclosed

Feel free to reopen this ticket with more informations :)

Note: See TracTickets for help on using tickets.