taskwarrior icon indicating copy to clipboard operation
taskwarrior copied to clipboard

Segmentation fault when running 'task info' with malformed undo

Open NGenetzky opened this issue 5 years ago • 2 comments

[bug] 'segmentation fault' when running 'task info' with empty undo or backlog

Thank you for looking at this bug. I understand that I was wrong to alter the data files and I simply shouldn't do that, but as a developer myself, I always like to know ways I can make my programs more robust.

I have followed the requested bug template, you will find the following sections below.

  • What command(s) did you run?
  • What did you expect to happen?
  • What actually happened?
  • Paste the output of the task diag command.

What command(s) did you run?

commit bd71c6376baf0f5d953991b39651de27341da7c2 (HEAD)
Author: Nathan Genetzky <[email protected]>
Date:   Sun Feb 2 13:03:40 2020 -0600

    task1

diff --git a/.task/backlog.data b/.task/backlog.data
index 8b13789..307e50e 100644
--- a/.task/backlog.data
+++ b/.task/backlog.data
@@ -1 +1,2 @@
 
+{"description":"task1","entry":"20200202T190336Z","modified":"20200202T190336Z","status":"pending","uuid":"a3a129a6-3ec7-4175-bdee-4cc0ced62240"}
diff --git a/.task/pending.data b/.task/pending.data
index e69de29..d4ff114 100644
--- a/.task/pending.data
+++ b/.task/pending.data
@@ -0,0 +1 @@
+[description:"task1" entry:"1580670216" modified:"1580670216" status:"pending" uuid:"a3a129a6-3ec7-4175-bdee-4cc0ced62240"]
diff --git a/.task/undo.data b/.task/undo.data
index 8b13789..d6cc6a8 100644
--- a/.task/undo.data
+++ b/.task/undo.data
@@ -1 +1,4 @@
 
+time 1580670216
+new [description:"task1" entry:"1580670216" modified:"1580670216" status:"pending" uuid:"a3a129a6-3ec7-4175-bdee-4cc0ced62240"]
+---

commit 6fee12f5edede88e8c1f5c533a06a1734dc93374
Author: Nathan Genetzky <[email protected]>
Date:   Sun Feb 2 13:03:22 2020 -0600

    echo '' into undo.data and backlog.data

diff --git a/.task/backlog.data b/.task/backlog.data
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/.task/backlog.data
@@ -0,0 +1 @@
+
diff --git a/.task/undo.data b/.task/undo.data
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/.task/undo.data
@@ -0,0 +1 @@
+

commit ccc35c9c1467f6f92cfae2f35bead40f7b17a655
Author: Nathan Genetzky <[email protected]>
Date:   Sun Feb 2 12:59:38 2020 -0600

    task init; but then amend and remove all comments

diff --git a/.task/completed.data b/.task/completed.data
new file mode 100644
index 0000000..e69de29
diff --git a/.task/pending.data b/.task/pending.data
new file mode 100644
index 0000000..e69de29
diff --git a/.taskrc b/.taskrc
new file mode 100644
index 0000000..408decf
--- /dev/null
+++ b/.taskrc
@@ -0,0 +1,2 @@
+# [Created by task 2.5.1 2/2/2020 12:58:50]
+data.location=/tmp/tmp-taskd/.task/

commit 365477ed93d9603bbeca8cd45732457f768944b5
Author: Nathan Genetzky <[email protected]>
Date:   Sun Feb 2 12:58:28 2020 -0600

    add env to use local taskdata and taskrc

diff --git a/__env__.sh b/__env__.sh
new file mode 100644
index 0000000..e0f1c93
--- /dev/null
+++ b/__env__.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+# taskwarrior
+TASKDATA="$(pwd)/.task/"
+TASKRC="$(pwd)/.taskrc"
+export \
+    TASKDATA \
+    TASKRC
  • What did you expect to happen?
-> task 1
[ERROR] Error reading taskdata from "/tmp/tmp-taskd/.task/backlog.data. Aborting.
  • What actually happened?
-> task 1
[1]    6794 segmentation fault (core dumped)  task 1

task diag

-> task diag
TASKRC override: /tmp/tmp-taskd/.taskrc
TASKDATA override: /tmp/tmp-taskd/.task/

task 2.5.1
   Platform: Linux

Compiler
    Version: 8.3.0
       Caps: +stdc +stdc_hosted +LP64 +c8 +i32 +l64 +vp64 +time_t64
 Compliance: C++11

Build Features
      CMake: 3.13.4
    libuuid: libuuid + uuid_unparse_lower
  libgnutls: 3.6.5
 Build type: None

Configuration
       File: /tmp/tmp-taskd/.taskrc (found), 80 bytes, mode 100644
       Data: /tmp/tmp-taskd/.task/ (found), dir, mode 40755
     TASKRC: /tmp/tmp-taskd/.taskrc
   TASKDATA: /tmp/tmp-taskd/.task/
    Locking: Enabled
         GC: Enabled
    $VISUAL: vim
     Server: 
      Trust: strict
Certificate: , not readable, 0 bytes
        Key: , not readable, 0 bytes
    Ciphers: NORMAL
      Creds: 

Hooks
     System: Enabled
   Location: /tmp/tmp-taskd/.task//hooks
             (-none-)

Tests
      $TERM: xterm-256color (317x70)
       Dups: Scanned 1 tasks for duplicate UUIDs:
             No duplicates found
 Broken ref: Scanned 1 tasks for broken references:
             No broken references found

NGenetzky avatar Feb 02 '20 19:02 NGenetzky

There is an empty line (\n) at the beginning of the undo.data file, which caused the segfault here.

laurence6 avatar Mar 21 '20 02:03 laurence6

Reproduced on 2.6.0. @laurence6 is indeed right regarding the cause

tbabej avatar Jun 19 '21 18:06 tbabej

there's no more undo.data, so this is no longer an issue.

djmitche avatar May 27 '24 21:05 djmitche