Author: Eric Raymond
Keywords: GPS, translator, mxmap, GIS

Bugs GPSD Exposes In Other Software

This page used to be part of the to-do list in our source distribution, until we realized it would be useful for the rest of the Web to see these bug reports. Where we can identify a responsible maintainer, we've tried to kick these upstream.

# Links to Open User-Visible Problems

- Buggy pl2303 drivers on Mac OS X can make select(2) look broken
- Firmware problems in some Bluetooth and USB devices can hang them
- Linux pl2303 driver on openwrt 2.4 kernel can hang when device is read at unexpected speed
- pthread_create() fails to return when called in background
- NTPSHM clobbers altitude under 2.4 Linux
- Linux kernel doesn't generate udev close events

# Links to Open Toolchain Bugs

- Multiple definitions of symbol _gpsd_report due to libtool bug
- Defective Python installation in SuSE 10.3rc
- Compiler optimizer bugs can produce error-modeling errors

# Links to Fixed Bugs

- Distro-dependent problems with gpsd startup
- The 2.3.0-beta version of OpenMotif shipped with Fedora Core 5 was buggy.
- Python socket library barfs on IPV6 notation in the /etc/hosts file
- isgps.c triggers an optimizer bug in older gcc versions
- gpsd build may break on 64-bit systems running Fedora Core 5
- Incorrect generation of floating-point code in embedded toolchains

# Open User-Visible Problems

## Buggy pl2303 drivers on Mac OS X can make select(2) look broken

When the fd set being polled includes tty devices (as opposed to sockets), select(2) can return 0 and shows no fd with input waiting even when data is in fact ready to be read from some of the devices.

The most recent incarnation of this problem was due to a buggy pl2303 USB-to-serial driver. OS X users should ensure that all their drivers are up to date. As of January 2009, this is still a problem - the most recent report being a failure of the drivers from osx-pl2303.sourceforge.net on OS X 10.5.6. Please try the latest drivers from www.prolific.com.tw before reporting hangs on OS X.

## Firmware problems in some Bluetooth and USB devices can hang them

The baudrate-hunting code in `gpsd` tickles a serious firmware bug on some some Bluetooth devices, notably those shipped by Holux and including the GPSlim-236. This bug may render these GPSes catatonic. The problem seems to be that buggy firmware inside these receivers doesn't necessarily keep the Bluetooth serial-port emulation and the GPS chip talking at the same baud rate. This problem is not unique to `gpsd` — Windows users are warned against using SiRFdemo's "Synchronize Protocol/Baud Rate" option on Bluetooth devices.

If this happens, you can sometimes recover by repeatedly sending reset messages using `gpsctl`

. The only guaranteed fix is to drain the battery backing up the GPS's settings; in extreme cases, you may have to open the case and unsolder the backup battery so the chip forgets its configuration settings.

A separate bug with less severe symptoms afflicts some USB devices. The probe strings `gpsd` sends in orderv to determine device type and subtype may be more than a device can handle, causing it to hang; power-cycling should fix this. Newer versions of `gpsd` break up the probe writes into smaller pieces, interleaving them with the first few packet reads, so they are far less likely to trigger this bug.

Use the -b option of gpsd to prevent it from trying to reconfigure your GPS; this will avoid both problems.

## Linux pl2303 driver on openwrt 2.4 kernel can hang when device is read at unexpected speed

Michael R. Davis reports "If you read from the device at the wrong rate (e.g. cat /dev/xxx) it will lock up. On openwrt it required a hard reboot." Details here. This bug was reported in 2006 with an old kernel version and may since have been fixed.

## pthread_create() fails to return when called in background

There is a call to pthread create in libgpsd_core.c::link_activate():

        /*@i1@*/(void)pthread_create(&pt,NULL,gpsd_ppsmonitor,(void *)session);

If this is called when gpsd is in the foreground then the thread is created fine and pthread_create() returns right away. If this is called when gpsd is in the background then the thread is created fine, but it may return! That freezes the main loop of gpsd. There is a workaround, but the nature of the workaround only makes ther bug more mysterious.

## NTPSHM clobbers altitude under 2.4 Linux

We've had one report (in march 2009) of the NTPSHM feature clobbering altitude reports, on a Technologic TS-5500 board running a customized 2.4.34 kernel using a `gpsd` built with GCC 2.95.3. When NTPSHM was disabled, altitude was reported correctly.

Shared memory was bug-plagued on older Linux kernels; one notorious symptom of this was that the emulation of System V IPC worked poorly, and we suspect our corruption bug is another symptom. No such misbehavior has been reported from our NTPSHM-using developers under 2.6. It is also possible that this is due to some obscure bug in GCC or elsewhere in Technologic's cross-development toolchain.

## Linux kernel doesn't generate udev close events

One user has reported that the GPSD hotplug wrapper is not being invoked on unplug of a USB receiver, because the kernel never actually generates a remove event when closing an open serial device. Apparently this is a well-known bug that will not be easily fixed.

# Open Toolchain Bugs

`gpsd` is distressingly good at tickling bugs in development toolchains. Most of these, thankfully, are non-issues if you keep your toolchain up to date.

## Multiple definitions of symbol _gpsd_report due to libtool bug

Some people building gpsd get 'multiple definitions of symbol _gpsd_report' as a warning. This seems to be a result of two bugs in libtool, one of which masks the other on i386. gpsd_report() is indeed multiply defined, the problem is that libtool generates libgps.o where it should generate -lgps and all instances (rather than just the first to be incorporated by other linkage demands) are linked in.

## Defective Python installation in SuSE 10.3rc

The Python 2.5 installed with SuSE 10.3rc is missing a needed Makefile. This prevents the `gpsd` Python components from building correctly.

## Compiler optimizer bugs can produce error-modeling errors<

The floating-point code in the daemon's error modeler (the logic that produces uncertainty estimates in the sensor doesn't supply them) is sensitive to optimizer bugs. If the optimizer is flaky, different levels of operation can cause the speed calculation to either converge or blow up in FP operations; the effect is that when it is actually reported seems to vary randomly with level of optimization.

Under GCC 4.2.1, -O2 diverges from what GCC 4.4.1 reports, causing regression-test failures. Dropping back to -O1 or going up to -O3 restores behavior like GCC 4.4.1's.

# Fixed Problems

We document these here in case you're running on an older system. They will be removed as they become sufficiently ancient.

## Distro-dependent problems with gpsd startup

See this Gentoo bug. This shows up on other distributions as well, but not under Fedora Core. The Gentoo problem can be fixed by creating a /var/run/usb directory; this fix may apply to other distributions as well.

## The 2.3.0-beta version of OpenMotif shipped with Fedora Core 5 was buggy.

xgps tickles a bug, described at http://bugs.motifzone.net/ as bugs 1330 and 1331 and marked FIXED, in some versions of OpenMotif. The symptom is that the satellite-data window in xgps is too small. Avoid by either upgrading to 2.3.0-0.1.9.3 (or later) or dropping back to a stable version like 2.2.2. Alternatively, remove OpenMotif and install lesstif. For gpsd's purposes, lesstif is a completely compatible drop-in replacement.

## Python socket library barfs on IPV6 notation in the /etc/hosts file

Robert J.Berger reports: Until I changed the line in /etc/hosts from:

    ::1    localhost.localdomain   localhost

to:

    127.0.0.1       localhost.localdomain   localhost

gps.py would fail when trying to open the socket connection to the gpsd:

       File "/usr/local/bin/spGps.py", line 198, in __init__
         self.connect(host, port)
       File "/usr/local/bin/spGps.py", line 237, in connect
         raise socket.error, msg
    socket.error: (111, 'Connection refused')

and gpsprof would fail with:

    # gpsprof | gnuplot -persist
    gpsprof: gpsd unreachable.

This is with Python 2.4.4 under Red Hat Linux, kernel version 2.6.18. This was filed upstream as Python bug 1603527 on trheir old tracker, and is no longer open on their new one.

## isgps.c triggers an optimizer bug in older gcc versions

The isgps.c file confuses the gcc-3.4.[23] optimizer at -O2 level, making it generate incorrect code. Removing -O2 from the compilation flags works around the problem. Details are in the isgps.c source file.

Compiling with --enable-max-devices=1 may trigger a gcc optimizer bug

At gpsd revision level 3365, compiling with --enable-max-devices=1 has been observed to trigger an optimizer bug in gcc 4.1.0 20060304 (Red Hat 4.1.0-3). The symptom is a for-loop termination condition not causing an exit, leading to a core dump. Removing -O2 from the compilation flags works around the problem; upgrading to gcc 4.1.1 20060525 (Red Hat 4.1.1-1) solves it. Other reports indicate this bug was introduced sometime after gcc 4.0.2 20051125 (Red Hat 4.0.2-8).

## gpsd build may break on 64-bit systems running Fedora Core 5

The problem may be be caused by the old ld (binutils-2.15.92.0.2-18) being incompatible with gcc 4.1.0 on a 64-bit system. Updating to binutils 2.16.1 or later avoids it.

## Incorrect generation of floating-point code in embedded toolchains

One problem area is errors in generation of floating-point code. A number of trouble reports have been received indicating erroneous results on embedded platforms, most notably ARM systems. These have all been traced back to the toolchain; when appropriate corrective action was taken, `gpsd` functioned correctly. Source code for a simple test program (`floattest.c`) is in the project repository; if `gpsd` seems to be producing incorrect output, please use this tool to validate your toolchain before filing a bug report.

## Mac OS 10.5 X library packaging problem

Building `xgpsspeed` will fail under MacOS 10.5.6 because the X SDK libraries and include files are not installed to the canonical places. This was filed as a bug with Apple and is reported fixed.

Search for GPS-related information here:

Web | gpsd.berlios.de