Bug#625949: navit shows wrong coordinates if LC_ALL is set

2011-05-07 Thread Timo Juhani Lindfors
Package: navit
Version: 0.2.0+dfsg.1-1
Severity: important

Steps to reproduce:
1) wget http://iki.fi/lindi/foxtrotgps/met-to-ota2.dump.xz
2) unxz met-to-ota2.dump.xz
3) gpsfake -c 0.5 met-to-ota2.dump
4) LC_ALL=fi_FI.UTF-8 navit
5) click on the map to get to menu
6) click Toiminnat (=Actions)

Expected results:
6) location is 60deg 13' 52 N 24deg 24' 32 E

Actual results:
6) location is 60deg 0' 31 N 24deg 0' 52 E

More info:
1) upstream seems to consider this to be a known issue but I could not
find a bug report about it. It definitely is an important issue since
somebody might actually believe the wrong coordinates and setting
LC_ALL should be pretty standard.

The code has

if (getenv(LC_ALL))
dbg(0,Warning: LC_ALL is set, this might lead to problems (e.g. 
strange positions from GPS)\n);

but I could not figure out how to enable that dbg. It would also only
go to debug log which the normal user is not going to notice.

Upstream FAQ at http://wiki.navit-project.org/index.php/FAQ has

  My position is reported incorrectly

   Most of the time, this is caused by the decimal separator being
   incorrectly set. Navit tries to override the decimal separator at
   startup, but the LC_ALL environment variable can block this. You
   can check this easily : echo $LC_ALL

   If it returns something, you can't override your locale
   settings. You should unset LC_ALL and try again. If it works,
   you got it :)

   In gentoo, this is set in the /etc/env.d/somethinglocales. You
   may want to remove or comment the LC_ALL line in that file. 

which gives me the impression that they have lost hope and don't think
this issue can be fixed.

2) Do you know which function ends up using the wrong decimal
separator? Surely other programs in debian must be hit by the issue
too?

3) Do you know if there's an upstream bug report about this somewhere?
I only wrote svn change
http://navit.svn.sourceforge.net/viewvc/navit/trunk/navit/navit/main.c?r1=2082r2=2125
that touches the warning that is printed when debugging is enabled
(how?).

4) If all else fails, would it make sense to ship a wrapper script
that unsets LC_ALL before exec'ing navit binary? In the debian changelog
I see

navit (0.0.4+svn1229-3) unstable; urgency=low

  * fixed a small bug in navit.pl: delete LC_ALL from the environment,
instead
of only undefining it.

 -- Carsten Wolff cars...@yet-another-geek.org  Sat, 25 Oct 2008
21:07:46 +0200

but this has probably already been rewritten completely?



-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/4 CPU cores)
Locale: LANG=C, LC_CTYPE=fi_FI (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/dash

Versions of packages navit depends on:
ii  libc6   2.11.2-13Embedded GNU C Library: Shared lib
ii  libdbus-1-3 1.4.6-1  simple interprocess messaging syst
ii  libdbus-glib-1-20.92-1   simple interprocess messaging syst
ii  libfontconfig1  2.8.0-2.1generic font configuration library
ii  libfreetype62.4.4-1  FreeType 2 font engine, shared lib
ii  libfribidi0 0.19.2-1 Free Implementation of the Unicode
ii  libgarmin0  0~svn320-1   Garmin image format library (runti
ii  libglib2.0-02.28.2-1 The GLib library of C routines
ii  libgps192.95-12  Global Positioning System - librar
ii  libspeechd2 0.7.1-5  Speech Dispatcher: Shared librarie
ii  libssl0.9.8 0.9.8o-5 SSL shared libraries
ii  navit-data  0.2.0+dfsg.1-1   Car navigation system with routing
ii  navit-gui-gtk   0.2.0+dfsg.1-1   Car navigation system with routing
ii  navit-gui-internal  0.2.0+dfsg.1-1   Car navigation system with routing
ii  zlib1g  1:1.2.3.4.dfsg-3 compression library - runtime

Versions of packages navit recommends:
ii  gpsd  2.95-12Global Positioning System - daemon

Versions of packages navit suggests:
ii  maptool   0.2.0+dfsg.1-1 Converts OpenStreetMap maps to Nav

-- no debconf information



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#625949: navit shows wrong coordinates if LC_ALL is set

2011-05-07 Thread Gilles Filippini
Hi Timo,

Timo Juhani Lindfors a écrit , Le 07/05/2011 12:24:
 Steps to reproduce:
 1) wget http://iki.fi/lindi/foxtrotgps/met-to-ota2.dump.xz
 2) unxz met-to-ota2.dump.xz
 3) gpsfake -c 0.5 met-to-ota2.dump
 4) LC_ALL=fi_FI.UTF-8 navit
 5) click on the map to get to menu
 6) click Toiminnat (=Actions)
 
 Expected results:
 6) location is 60deg 13' 52 N 24deg 24' 32 E
 
 Actual results:
 6) location is 60deg 0' 31 N 24deg 0' 52 E

Which graphic and gui backends do you use. I can't reproduce your
results with graphic-gtk-drawing-area + gui-internal:

 pini@pini:~$ LC_ALL=fi_FI.UTF-8 navit
 navit:main_init:Warning: LC_ALL is set, this might lead to problems
 (e.g. strange positions from GPS)

 (process:6049): Gtk-WARNING **: Locale not supported by C library.
Using the fallback 'C' locale.

 (unknown:6049): Gdk-WARNING **: locale not supported by C library

 
 More info:
 1) upstream seems to consider this to be a known issue but I could not
 find a bug report about it. It definitely is an important issue since
 somebody might actually believe the wrong coordinates and setting
 LC_ALL should be pretty standard.
 
 The code has
 
 if (getenv(LC_ALL))
 dbg(0,Warning: LC_ALL is set, this might lead to problems (e.g. 
 strange positions from GPS)\n);
 
 but I could not figure out how to enable that dbg. It would also only
 go to debug log which the normal user is not going to notice.

This wiki entry may help:
http://wiki.navit-project.org/index.php/Configuring_Navit#Debugging

 
 Upstream FAQ at http://wiki.navit-project.org/index.php/FAQ has
 
   My position is reported incorrectly
 
Most of the time, this is caused by the decimal separator being
incorrectly set. Navit tries to override the decimal separator at
startup, but the LC_ALL environment variable can block this. You
can check this easily : echo $LC_ALL
 
If it returns something, you can't override your locale
settings. You should unset LC_ALL and try again. If it works,
you got it :)
 
In gentoo, this is set in the /etc/env.d/somethinglocales. You
may want to remove or comment the LC_ALL line in that file. 
 
 which gives me the impression that they have lost hope and don't think
 this issue can be fixed.
 
 2) Do you know which function ends up using the wrong decimal
 separator? Surely other programs in debian must be hit by the issue
 too?
 
 3) Do you know if there's an upstream bug report about this somewhere?
 I only wrote svn change
 http://navit.svn.sourceforge.net/viewvc/navit/trunk/navit/navit/main.c?r1=2082r2=2125
 that touches the warning that is printed when debugging is enabled
 (how?).
 
 4) If all else fails, would it make sense to ship a wrapper script
 that unsets LC_ALL before exec'ing navit binary? In the debian changelog
 I see
 
 navit (0.0.4+svn1229-3) unstable; urgency=low
 
   * fixed a small bug in navit.pl: delete LC_ALL from the environment,
 instead
 of only undefining it.
 
  -- Carsten Wolff cars...@yet-another-geek.org  Sat, 25 Oct 2008
 21:07:46 +0200
 
 but this has probably already been rewritten completely?

Thanks,

_g.



signature.asc
Description: OpenPGP digital signature


Bug#625949: navit shows wrong coordinates if LC_ALL is set

2011-05-07 Thread Gilles Filippini
forwarded 625949 http://trac.navit-project.org/ticket/850
tag 625949 patch
thanks


Timo Juhani Lindfors a écrit , Le 08/05/2011 00:00:
 Gilles Filippini p...@debian.org writes:
 Which graphic and gui backends do you use.
 
 I'm attaching complete ~/.navit/navit.xml this time.
 
  (process:6049): Gtk-WARNING **: Locale not supported by C library.
  Using the fallback 'C' locale.

  (unknown:6049): Gdk-WARNING **: locale not supported by C library
 
 Does locale -a list fi_FI.UTF-8? If not, can you generate it with
 sudo dpkg-reconfigure locales and try again?

Indeed. I can reproduce the problem now.

 
 but I could not figure out how to enable that dbg. It would also only
 go to debug log which the normal user is not going to notice.

 This wiki entry may help:
 http://wiki.navit-project.org/index.php/Configuring_Navit#Debugging
 
 Sure, I was just trying to point out that the current warning is not
 something that people actually notice.

Sure. I've opened a ticket upstream [1] and set up a patch which, when
LC_ALL is set, unset it and set LANG instead.
Committed to my git repo and attached here.

[1] http://trac.navit-project.org/ticket/850

Thanks,

_g.
Description: Set lang instead of LC_ALL to prevent decimal separator bugs
 In case LC_ALL is set, unset it and set LANG instead.
Author: Gilles Filippini p...@debian.org
Forwarded: http://trac.navit-project.org/ticket/850
Last-Update: 2011-05-08
Index: navit/navit/main.c
===
--- navit.orig/navit/main.c	2011-05-08 00:17:11.0 +0200
+++ navit/navit/main.c	2011-05-08 00:23:49.0 +0200
@@ -407,8 +407,12 @@
 	main_setup_environment(2);
 #endif	/* _WIN32 || _WIN32_WCE */
 
-	if (getenv(LC_ALL))
+	if (getenv(LC_ALL)) {
 		dbg(0,Warning: LC_ALL is set, this might lead to problems (e.g. strange positions from GPS)\n);
+		dbg(0,Warning: Unsetting LC_ALL and setting LANG instead as a workaround.\n);
+		setenv(LANG, getenv(LC_ALL), 1);
+		unsetenv(LC_ALL);
+	}
 	s = getenv(NAVIT_WID);
 	if (s) {
 		setenv(SDL_WINDOWID, s, 0);


signature.asc
Description: OpenPGP digital signature