Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 136763 - xscreensaver fails many savers with some locales
Summary: xscreensaver fails many savers with some locales
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Desktop Misc. Team
URL: http://www.jwz.org/xscreensaver/
Whiteboard:
Keywords:
Depends on: 143662
Blocks:
  Show dependency tree
 
Reported: 2006-06-14 04:50 UTC by Gianluca Parmiggiani
Modified: 2006-09-15 02:46 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gianluca Parmiggiani 2006-06-14 04:50:03 UTC
Many 3D screen savers (juggler3d for example) fails to start if locale is set to it_IT.UTF-8 and I guess to other locales not using . (dot) as decimal separator with the following messages:

riekr@pegasus ~ $ xscreensaver-demo
juggler3d: juggleSpeed must be a float, not 2.2.
juggler3d: translateSpeed must be a float, not 0.1.
juggler3d: spinSpeed must be a float, not 20.0.
juggler3d: juggleSpeed must be a float, not 2.2.
juggler3d: translateSpeed must be a float, not 0.1.
juggler3d: spinSpeed must be a float, not 20.0.

setting locale to posix let savers start:

riekr@pegasus ~ $ export LANG=POSIX
riekr@pegasus ~ $ locale
LANG=POSIX
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=
riekr@pegasus ~ $ xscreensaver-demo
riekr@pegasus ~ $
Comment 1 Gianluca Parmiggiani 2006-06-14 04:51:15 UTC
(forgot emerge --info)

Portage 2.1 (default-linux/x86/dev/2006.1/desktop, gcc-4.1.1/vanilla, glibc-2.4-r3, 2.6.16-gentoo-r9 i686)
=================================================================
System uname: 2.6.16-gentoo-r9 i686 Intel(R) Pentium(R) 4 CPU 3.00GHz
Gentoo Base System version 1.12.1
dev-lang/python:     2.3.5-r2, 2.4.3-r1
dev-python/pycrypto: 2.0.1-r5
dev-util/ccache:     [Not Present]
dev-util/confcache:  [Not Present]
sys-apps/sandbox:    1.2.18.1
sys-devel/autoconf:  2.13, 2.59-r7
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2
sys-devel/binutils:  2.16.1-r2
sys-devel/gcc-config: 2.0.0_rc1
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.11-r5
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O3 -march=pentium4 -fomit-frame-pointer -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/X11/xkb"
CONFIG_PROTECT_MASK="/etc/env.d /etc/eselect/compiler /etc/gconf /etc/revdep-rebuild /etc/splash /etc/terminfo /etc/texmf/web2c"
CXXFLAGS="-O3 -march=pentium4 -fomit-frame-pointer -pipe -fvisibility-inlines-hidden"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig distlocks metadata-transfer parallel-fetch prelink sandbox sfperms strict"
GENTOO_MIRRORS="http://mirrors.sec.informatik.tu-darmstadt.de/gentoo/ http://www.die.unipd.it/pub/Linux/distributions/gentoo-sources/ http://ftp.belnet.be/mirror/rsync.gentoo.org/gentoo/ http://gentoo.intergenia.de http://pandemonium.tiscali.de/pub/gentoo/"
LANG="POSIX"
MAKEOPTS="-j1"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude='/distfiles' --exclude='/local' --exclude='/packages'"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="x86 7zip X X509 a52 aac acpi adns aim alsa amr ao asf attr audiofile avahi avi bash-completion beagle berkdb bitmap-fonts bluetooth bogofilter bonobo branding bzip2 bzlib cairo caps cddb cdparanoia cdr cli cpudetection crypt cscope ctype cups curl db2 dbus dga dmx dri dts dv dvd dvdr dvdread dvi eds emboss encode ethereal evo evolution exif fam fbcon fbsplash ffmpeg fftw firefox flac flash foomaticdb fpx freetds ftp gcj gd gdbm gecko-sdk ggi gif gimp glitz glut gmail gmp gnome gnutls gphoto2 gpm gps gstreamer gstreamer010 gtk gtk2 gtkhtml hal howl iconv icq id3 idea idn ieee1394 imagemagick imap imlib immqt-bc inifile irda irmc isdnlog java jingle joystick jpeg jpeg2k junit lcms ldap libg++ live logrotate lzo mad matroska mbox mikmod mime mmap mmx mmx2 mmxext mng modplug mono mozdevelop moznocompose moznoirc moznomail mozsvg mp3 mp4 mpeg mpeg2 mpi mppe-mppc msn mssql musepack musicbrainz nautilus ncurses netcdf network nls no_wxgtk1 nodoc nomalloccheck nptl nptlonly nsplugin ntplonly oci8 odbc ofx ogg oggvorbis openal opengl oracle oscar pam pam_timestamp pcmcia pcntl pcre pda pdflib perl pic png pnp pop posix pppd python quicktime readline real recode reflection reiserfs rtc samba scanner sdl session shared sharedmem slang smp sms speex spell spl sse sse2 ssl startup-notification svg sysvipc t1lib tagwriting tcltki tcpd tetex tga theora threads tidy tiff truetype truetype-fonts type1-fonts udev unicode usb utf8 vim-with-x vorbis win32codecs wmf x264 xinerama xml xorg xosd xpm xscreensaver xsl xv xvid xvmc yahoo yv12 zeroconf zlib elibc_glibc input_devices_evdev input_devices_keyboard input_devices_mouse input_devices_synaptics kernel_linux userland_GNU video_cards_ati video_cards_fglrx video_cards_radeon"
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LDFLAGS, LINGUAS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 2 Mamoru TASAKA 2006-06-14 12:15:18 UTC
Hello:
I am a Fedora user, but I know this issue . I was asked from Jamie about this issue and answered to him already.

---------------------------------------------------------------

Good morning, Jamie:

Jamie Zawinski wrote:
>
> On May 31, 2006, at 2:40 AM, TASAKA, Mamoru wrote:
>
>> Paolo's comment explained this problem very clearly. In xscreensaver-5.00 (which means
>> that my location patch is applied) and the locale is set to Italian, the decimal separator
>> must be comma (I didn't know!!), but get_float_resource() in utils/resource.c tries to
>> revert a string of which separator is dot to float value by sscanf().
>
> What changed?  Why did this work in 4.x?
>
The real problem was,
1. When main() is invoked, all the locales (written in setlocale(3)) are SET BY "C" by
default (even the environment is explicitly specified like "LANG=it_IT glschool")
2. sscanf(3) is affected by LC_NUMERIC (by man 7 locale).
3. My patch includes
    setlocale(LC_ALL, "");
this description , the point of which is that the second argument is "", means that all
the locales (including LC_NUMERIC) are changed according to the environment.
4. So, LC_NUMERIC is changed to it_IT (in xscreensaver-4.24, this was "C" because in
main(), LC_NUMERIC is also set as "C"), which requires that the numeric separator is comma
in it_IT. However, the numeric separator of the string passed to get_boolean_resource() is
still dot (as written in xml files).

It seems that the only need to change locale is for LC_TIME (for strftime() in gltext).
For other hacks, using non-multibyte text will meet the demand.

I rewrote my patch about locale issue against xscreensaver-5.00 (not xscreensaver-5.00b5).
  This patch only examines LC_TIME and don't change others. This patch changes screenhack.c again, but the change for utils/resource.c is NOT NEEDED.

Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp>



--- xscreensaver-5.00/hacks/screenhack.c.localefix2	2006-05-24 07:09:58.000000000 +0900
+++ xscreensaver-5.00/hacks/screenhack.c	2006-06-01 08:06:32.000000000 +0900
@@ -166,19 +166,39 @@
 reset_locale (void)
 {
 #ifdef HAVE_SETLOCALE
-  const char *current_locale = setlocale(LC_ALL, "");
-  const char *cmp_locale;
-  int j = 0;
+  /* What locale should be checked??
+   */
+  const int examine_locale[] = {
+#ifdef LC_TIME
+    LC_TIME,
+#endif
+    0
+  };
+  int j;
 
-  while ((cmp_locale = change_locale[j]))
+  for (j = 0; examine_locale[j]; j++)
     {
-      if (!strncmp(current_locale, cmp_locale, strlen(cmp_locale)))
+      const char *current_locale = setlocale(examine_locale[j], NULL);
+      const char *env_locale = setlocale(examine_locale[j], "");
+      const char *cmp_locale;
+
+      if (!env_locale || !*env_locale) 
 	{
-	  setlocale(LC_ALL, "C");
-	  break;
+	  setlocale(examine_locale[j], current_locale);
+	  continue;
+	}
+
+      while ((cmp_locale = change_locale[j]))
+	{
+	  if (!strncmp(env_locale, cmp_locale, strlen(cmp_locale)))
+	    {
+	      (void) setlocale(examine_locale[j], "C");
+	      continue;
+	    }
+	  j++;
 	}
-      j++;
     }
+
 #endif /* HAVE_SETLOCALE */
 }
 

Comment 3 jack_mort 2006-06-24 03:30:24 UTC
I tested the patch and it works well : my GLMatrix is working again ^_^
Comment 4 Santiago Gala 2006-06-24 13:22:37 UTC
The ebuild is still failing for Spanish locale. Again, Spanish uses a "," instead of a dot as decimal separator, so a lot of screensavers fail:

sgala@marlow ~ $ /usr/lib/misc/xscreensaver/molecule -no-labels -fps
molecule: shellAlpha must be a float, not 0.3.
molecule: <builtin-0>: parse error, line 6: HETATM    1  C           1       0.000   0.000   0.000  1.00  0.00
HETATM    2  C           1       1.394   0.000   0.000  1.00  0.00
HETATM    3  C           1       2.084   1.211   0.000  1.00  0.00
HETATM    4  N           1       1.337   2.342  -0.002  1.00  0.00
HETATM    5  C           1      -0.017   2.313  -0.003  1.00  0.00
HETATM    6  N           1      -0.710   1.149  -0.001  1.00  0.00
HETATM    7  N           1      -0.391  -1.291   0.006  1.00  0.00
HETATM    8  C           1       0.731  -2.049   0.010  1.00  0.00
HETATM    9  N           1       1.843  -1.276   0.007  1.00  0.00
HETATM   10  N           1       3.485   1.257   0.004  1.00  0.00
HETATM   11  H           1      -0.567   3.254  -0.004  1.00  0.00
HETATM   12  H           1      -1.347  -1.630   0.010  1.00  0.00
HETATM   13  H           1       0.738  -3.139   0.017  1.00  0.00
HETATM   14  H           1       3.799   2.220  -0.037  1.00  0.00
HETATM   15  H           1       3.839   0.818   0.847  1.00  0.00
CONECT    1    2    2    6    7
CONECT    2    1    1    3    9
CONECT    3    2    4    4   10
CONECT    4    3    3    5
CONECT    5    4    6    6   11
CONECT    6    1    5    5
CONECT    7    1    8   12
CONECT    8    7    9    9   13
CONECT    9    2    8    8
CONECT   10    3   14   15
CONECT   11    5
CONECT   12    7
CONECT   13    8
CONECT   14   10
CONECT   15   10
MASTER        0    0    0    0    0    0    0    0   15    0   15    0
END

LC_ALL=C /usr/lib/misc/xscreensaver/molecule -no-labels -fps

works.
Comment 5 Gianluca Parmiggiani 2006-09-04 03:07:36 UTC
a patch for reading floats correctly has been supplied and it is in portage.
Comment 6 Gianluca Parmiggiani 2006-09-15 02:46:03 UTC
Tested, it works for me