Crashing J-Pilot

· klm's blog


Original post is here: eklausmeier.goip.de

I am using J-Pilot since more than 20 years. I mostly use:

  1. Datebook as kind of a diary and for accounting purposes (what did I do for client X at date Y)
  2. Address
  3. Memos

I use Todo's rarely, if at all. I had used Todo's in the past a bit. For the Expense part: I just played with Expenses, but never used it for something essential.

I am currently changing J-Pilot, the Gtk3 based version, from the internal binary format to full SQLite format. See Possible Enhancements to J-Pilot and SQL Datamodel For J-Pilot.

Implementation reached completion, so testing old and new version side by side, to see whether I degraded anything. I observed bugs which have been present before I started my implementation. J-Pilot crashes under the following scenarios. Crash is

segmentation fault (core dumped)

1. In Address: When searching for names in addresses in the lower search bar, then J-Pilot crashes whenever I press the "Up" key. This crash is easy to reproduce. See search bar in below image, where I entered "abc".

This bug is not present in the Gtk2 version.

2. In Datebook: When cancelling changes in a repeating event, sometimes J-Pilot crashes, when one wants to ignore the conducted changes.

3. In To-Do: Clicking on "Completed" checkbox will eventually crash J-Pilot. Have not fully figured what the exact sequence is to reproduce it. But just creating a to-do entry, then copying it multiple times, then "completing" two or three of them will pretty soon lead to the crash. The crash also occurs if you check the complete-mark "too often". So it seems that "too many" completes crash the app. J-Pilot crashes here:

1Thread 1 "jpilot" received signal SIGSEGV, Segmentation fault.
2handleRowSelection (selection=0x5555560050d0, model=0x555555aaf9e0, path=0x555555ad3ba0, path_currently_selected=0, userdata=0x0) at todo_gui.c:1757
31757                if (todo->description[0]) {

Checking todo variable gives:

1(gdb) p *todo
2$9 = {indefinite = 1801678700, due = {tm_sec = 1919249510, tm_min = 1751343458, tm_hour = 1632378924, tm_mday = 745694569, tm_mon = 1717913632, tm_year = 745694574, tm_wday = 1952533280, tm_yday = 1651402106,
3    tm_isdst = 1751360707, tm_gmtoff = 8233178444191855171, tm_zone = 0x6544202c61646e65 <error: Cannot access memory at address 0x6544202c61646e65>}, priority = 745761134, complete = 1936017184,
4  description = 0x202c61 <error: Cannot access memory at address 0x202c61>, note = 0x80 <error: Cannot access memory at address 0x80>}

It seems that something was deallocated, which is still needed. Or, more likely, list and processing got completely wracked, as many other records are modified, although they should not have been modified.

Added 14-Nov-2022: When running in debug-mode, i.e., with command-line flag -d, then setting a yearly repeat will crash. Fixed with proper jp_logf() arguments, %d instead of %s. I guess this is above point 2.

Added 21-Nov-2022: When importing CSV into Datebook, which was previously exported by J-Pilot, the array repeatDays[] is not populated correctly in the case of repeatType == calendarRepeatNone. A check for end of string needs to be added in cb_dbook_import().

Added 22-Nov-2022: Quicksearch crash, i.e., above point 1, can be fixed by setting third agument to NULL in selectRecordAddressByRow() in address_gui.c.

Added 30-Mar-2023: Switching screen bug, i.e., switching from address to memo for example, with function keys (F1, F2, etc.) multiple times, will crash J-Pilot. When clicking on large icons for switching, it will not crash. After some testing: The problem only occurs when switching to address. It does not occur when switching between datebook, memo or ToDo.

Added 09-May-2023: More info to "switching screen bug": Using gdb one finds:

Thread 1 "jpilot" received signal SIGSEGV, Segmentation fault.
0x00005555555775ab in address_gui (vbox=0x555555a9d6e0, hbox=0x55555603bd10) at address_gui.c:4330
4330                if (GTK_IS_COMBO_BOX(phone_type_list_menu[i]) &&

It seems that simply commenting out the entire double-loop in address_gui() solves the issue.

1/* Clear GTK option menus before use */
2for (i = 0; i < NUM_ADDRESSES; i++)

This entire loop is only for initializing, and this might be obsolete or simply wrong.

Added 10-May-2023: Repeating events show notes but no descriptions on right detail area, i.e., the edit area. On left area the notes are shown. This does not always happen. A brand new setup of data, either Palm data, or SQLite data, does not exhibit this behaviour.

Added 27-May-2023: Pressing cursor-down in Memo multiple times especially toward the end will crash J-Pilot.