GPSBabel / gpsbabel

GPSBabel: convert, manipulate, and transfer data from GPS programs or GPS receivers. Open Source and supported on MacOS, Windows, Linux, and more. Pointy clicky GUI or a command line version...
https://www.gpsbabel.org
GNU General Public License v2.0
473 stars 126 forks source link

fix faulty assertion in garmin. #1290

Closed tsteven4 closed 2 months ago

tsteven4 commented 2 months ago

This was reported on gpsbabel-code by Dirk.

I'm using GPSBabel with a Garmin eTrex H. Recently updated to Ubuntu MATE 24.04 LTS and since then GPSBabel crashes with the following error message:

gpsbabel: ./garmin.cc:380: void rw_init(const QString&): Zusicherung »!QString(valid_waypt_chars).contains('-')« nicht erfüllt.

'-' can be a valid waypoint character for some older Garmin devices as correctly defined in garmin.cc. Hence line 306 of the current garmin.cc

assert(!QString(valid_waypt_chars).contains('-'));

makes GPSBabel unusable for those devices.

The purpose of the assertion was to make sure we didn't have any PCRE metacharacters in our character class definition that we invert to get the invalid characters. In practice the dash was the last character in the class so wouldn't be considered a metacharacter anyway, but our assertion check wasn't sophisticated enough to allow this.

It appears that some distributions don't set CMAKE_BUILD_TYPE to something like Release that causes NDEBUG to be defined, thus assertions are enabled in their released code.

In any event, now that we have a requirement for Qt >= 6.2, we can use QString::removeIf(Predicate pred) and avoid QRegularExpression entirely.

tsteven4 commented 2 months ago

I have verified that gpsbabel_1.9.0+ds-3_amd64.deb from debian sid has assertions enabled.

tsteven4 commented 2 months ago

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1076083