Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 216493

Summary: games-board/xboard-4.2.7: doesn't read X11 resource files
Product: Gentoo Linux Reporter: Toralf Förster <toralf>
Component: Current packagesAssignee: Gentoo Games <games>
Status: RESOLVED INVALID    
Severity: minor    
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Toralf Förster gentoo-dev 2008-04-06 10:14:31 UTC
Wondering why that program ignored my lines in .Xdefaults:

tfoerste@n22 ~ $ grep ^XB .Xdefaults
XBoard*size:            Bulky
XBoard*geometry:         +0+0

I got the answer answer after I used strace:

read(3, "\1\0\n\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0<\26 \10\2005\223\277\2305\223\277", 32) = 32
uname({sys="Linux", node="n22", ...})   = 0
open("/home/tfoerste/.Xdefaults-n22", O_RDONLY) = -1 ENOENT (No such file or directory)

For some reason the program expects the hostname appended to .Xdefaults. But having a deeper look into the program it seems that it isn't able to read X11 resources, neither from .Xdefaults-n22 nor from ~/XBoard (content:

tfoerste@n22 ~ $ cat XBoard
XBoard*size:            Bulky
XBoard*geometry:         +0+0

) b/c strace shows :

access("/home/tfoerste/XBoard", R_OK)   = 0
stat64("/home/tfoerste/XBoard", {st_mode=S_IFREG|0644, st_size=61, ...}) = 0
open("/home/tfoerste/XBoard", O_RDONLY) = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=61, ...}) = 0
read(4, "XBoard*size:            Bulky\nXB"..., 61) = 61
close(4)                                = 0

I'm wondering why that program isn't able to read in the resource file. The program itself might be ancient old but the calls for open and read files should work even after years, isn't it ?

BTW the command line accept options so it isn't a big problem for me :)


Reproducible: Always
Comment 1 Toralf Förster gentoo-dev 2008-04-06 10:14:50 UTC
tfoerste@n22 ~ $ emerge --info
Portage 2.1.4.4 (default-linux/x86/2007.0, gcc-4.1.2, glibc-2.6.1-r0, 2.6.24-gentoo-r4 i686)
=================================================================
System uname: 2.6.24-gentoo-r4 i686 Intel(R) Pentium(R) M processor 1700MHz
Timestamp of tree: Sun, 06 Apr 2008 08:15:01 +0000
ccache version 2.4 [enabled]
app-shells/bash:     3.2_p17-r1
dev-java/java-config: 1.3.7, 2.1.4
dev-lang/python:     2.4.4-r9
dev-python/pycrypto: 2.0.1-r6
dev-util/ccache:     2.4-r7
sys-apps/baselayout: 1.12.11.1
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.61-r1
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.18-r1
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   1.5.26
virtual/os-headers:  2.6.23-r3
ACCEPT_KEYWORDS="x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=pentium-m -fomit-frame-pointer -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/config"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/terminfo /etc/udev/rules.d"
CXXFLAGS="-O2 -march=pentium-m -fomit-frame-pointer -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="ccache distlocks metadata-transfer parallel-fetch sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://de-mirror.org/distro/gentoo/ http://ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/ http://gentoo.mneisen.org/ http://213.186.33.37/gentoo-distfiles/"
LINGUAS="de en"
MAKEOPTS="-j 2"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.de.gentoo.org/gentoo-portage"
USE="X a52 aac acl acpi alsa apache2 arts berkdb bzip2 cairo caps cddb clamav cli cracklib crypt css cups dri dvd dvdr dvdread dynamicplugin encode exif fam fastbuild fortran gdbm gif gpm gtk hdaps hyphenation iconv ipv6 isdnlog jai java javascript jimi joystick jpeg kde logrotate mad madwifi mbox midi mikmod mmap mmx mmxext mp2 mp3 mp4 mpeg mudflap mysql ncurses nls nntp nptl nptlonly nsplugin ogg opengl openmp pam pcre pdf perl png ppds pppd python readline real reflection session spl sse sse2 ssl subversion svg tcpd tiff tk truetype unicode userlocales visualization vorbis wav wifi win32codecs wmf workbench x264 x86 xcomposite xml xorg xpm zlib" ALSA_CARDS="intel8x0 intel8x0m" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic auth_digest authn_anon authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif so speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse joystick evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="de en" USERLAND="GNU" VIDEO_CARDS="vga radeon"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

Comment 2 Tim Mann 2008-04-06 16:26:45 UTC
This is not specific to xboard.  I'm told the preferred name for that file changed from .Xdefaults to .Xresources long ago, and it seems the X libraries finally are looking only at .Xresources.

You can also put the lines in a file called XBoard.

The xboard man page should be updated, though.
Comment 3 Tim Mann 2008-04-06 16:34:57 UTC
Filed upstream as https://savannah.gnu.org/bugs/index.php?22853
Comment 4 Toralf Förster gentoo-dev 2008-04-06 18:57:33 UTC
The _real_ problem is that it doesn't even read those entries :

access("/home/tfoerste/XBoard", R_OK)   = 0
stat64("/home/tfoerste/XBoard", {st_mode=S_IFREG|0644, st_size=61, ...}) = 0
open("/home/tfoerste/XBoard", O_RDONLY) = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=61, ...}) = 0
read(4, "XBoard*size:            Bulky\nXB"..., 61) = 61    <-------wrong
close(4)                                = 0

The file consists of 2 lines but only the first line is read in and in addition the value even from the first line is not used :-(
Comment 5 Tim Mann 2008-04-08 16:48:55 UTC
Oops, sorry, I failed to read your initial bug report in full.  Stupid of me.

xboard (or more precisely, the Xt library that xboard is linked with) was reading the resource files in full, as the strace output shows.  When you say it's reading only the first line, that's incorrect -- you've misinterpreted the strace output.  The read system call read 61 bytes, which was the entire file.  strace showed a few bytes of that followed by "..." to indicate there was more.

The reason the "XBoard*size" resource didn't work for you is because there is no such resource.  The correct name of the resource is "XBoard*boardSize".  Please see the beginning of the OPTIONS section of the man page where it explains "For options that have two names, the longer one is the name of the corresponding X resource; the short name is not recognized."  The short name (-size in this case) works only as a command line option, not as a resource name.

I don't know why the geometry resource didn't work for you.  I tried the same thing on my Ubuntu 7.10 system with gnome desktop and it works for me.  Perhaps whatever window manager you're using is not respecting geometry requests from applications.
Comment 6 Toralf Förster gentoo-dev 2008-04-09 07:47:21 UTC
>"For options that have two names, the longer one is the name of the
corresponding X resource; the short name is not recognized."

Arrgh, my fault -sry.
BTW thanks for the explanation of the strace behaviour. I wasn't aware of that.

I close this report.