Menu

#1274 bug with todo.txt import/export and task deletion

Release_1.3.36
fixed-and-released
None
multiple
1
2014-06-14
2012-09-04
Aaron Wolf
No

Copied from someone who posted this at UserVoice:

If you export a todo.txt on each save, and import everytime before you save, it gets a stupid bug.

  1. Delete a Task
  2. Save
    2a) the old version todo.txt gets imported, which still includes the deleted task
    2b) the deleted Task appears again in TaskCoach
  3. a new version of the todo.txt gets exported
  4. the deleted task, now have to be deleted in the todo.txt first, before it can be deleted in taskcoach. ...

So it would be better to import only on startup.

Discussion

1 2 > >> (Page 1 of 2)
  • Aaron Wolf

    Aaron Wolf - 2012-10-01
    • platform_s: --> multiple
     
  • Holzhauer

    Holzhauer - 2014-02-07

    Fixed by avoiding import on save (since other formats usually do not record modification
    timestamps conflicts with external programs cannot be automatically resolved and should be overwritten.
    Additionally, tests have been adjusted and preferences GUI messages were updated.

     
  • Jérome Laheurte

    Actually duplicate of #1446. This should be fixed in 1.3.33. Is it not ?

     
  • Holzhauer

    Holzhauer - 2014-02-07

    It's not fixed in 1.3.35 - a deleted task still reappears after saving. The trunk still contains the import+export call on save.

     
  • Jérome Laheurte

    Nope, works well for me in Release1_3_Branch. I'm merging to trunk too. Do you have a tsk/txt pair that I could reproduce this with ?

     
  • Holzhauer

    Holzhauer - 2014-02-13

    It's easy to replicate:

    1. Suppose you have an empty file.
    2. Make sure that in Preferences in File tab the checkbox next to "Todo.txt format" in section "Before saving, automatically import from" is ticked (otherwise, changes in Todo.txt are not imported into Taskcoach when opening a file at all).
    3. Add an arbitrary Task
    4. Delete the task
    5. Save the Taskcoach file
    6. The deleted Task reapears again since it is imported at save from Todo.txt.

    The bug is still both in release 1.3.35 as well as in Release1_3_Branch.
    Can you find out what was changed in order to fix bug 1446?

     

    Last edit: Holzhauer 2014-02-13
  • Jérome Laheurte

    If I follow exactly your steps everything is obviously fine since there is no todo.txt file. My guess is that you have an existing todo.txt file and only enable import and not export, so the task getting recreated after save is perfectly normal since after saving the todo.txt file did not change...

     
  • Holzhauer

    Holzhauer - 2014-02-14

    OK, I forgot to mention that also the option "When saving, automatically export to" > "todo.txt" needs to be active (the todo.txt will be created then).
    A look into the source code (file Release1_3_Branch\taskcoach\taskcoachlib\persistence\autoimporterexporter.py line 41ff) helps: When both export and import are ticked tasks are imported from todo.txt first and afterwards are eported to todo.txt. This is nonsense since changes in Taskcoach get lost because the "old" tasks from todo.txt are imported before changes in Taskcoach are exported. However, the other way round is no better since also importing what was just exported is useless without a proper synchronisation which just seems impossible for todo.txt (s.o.).

     

    Last edit: Holzhauer 2014-02-14
  • Jérome Laheurte

    Actually there's a trick. When exporting to Todo.txt, Task Coach also writes a .txt-meta file, which is initially a copy of the .txt file. This is used to tell what changed in the .txt file upon import. The only problem I could see is if you overwrite a .tsk file having existing .txt and .txt-meta files, I don't think they're deleted before saving, that could lead to problems and I'll fix that.

    Anyway there are unsaid things in your scenario since I can't reproduce the problem with it. Could you try again from a blank state (no existing files) ?

     
  • Jérome Laheurte

    This bug should be fixed in the latest release of Task Coach. Can you please install the latest release of Task Coach and confirm that this bug has indeed been fixed?

    Thanks, Task Coach development team

     
  • Jérome Laheurte

    • status: fixed-and-released --> open
    • assigned_to: Jérome Laheurte
    • First version affected: Release_1.3.18 --> Release_1.3.36
     
  • Jérome Laheurte

    Reopening because we're not done yet :)

     
  • Holzhauer

    Holzhauer - 2014-02-17

    I tried again with the brand new release 1.3.36 and again from a complete blank state as before, with configuration file TaskCoach.ini moved. I haven't ever overwritten any .tsk file manually. The problem is still the same, deleted tasks reappear on save.

    Todo.txt-meta: This file is empty when I export to todo.txt. Thus, in case this file shall help TaskCoach to identify changes in todo.txt since last export, the mechanism is deemed to fail because existing tasks in todo.txt are considered new on import.

    If I got it right the trick could work correctly for removal and creation of tasks but not for modification (e.g. change of due date) since TaskCoach does not know when exactly a task was modified in todo.txt and thus cannot decide which modification is newer. Therefore, it should be possible to define which source wins on doubt. Furthermore, as far as I can see this is not properly documented in the TaskCoach help.

    Additionally, to be on the safe side, a user should edit only either TaskCoach or todo.txt at a time and store inbetween.

    Did you also tried to reproduce on Win 7?

     

    Last edit: Holzhauer 2014-02-17
  • Jérome Laheurte

    I just revamped the import/export, could you give it a try ? It works fine on Seven (for me at least).

    As for changes, the -meta file contains a copy of the .txt file after export. It's used to determine which tasks have been modified in the .txt file. Right now it would be difficult to do conflict detection/resolution, since in the release 1.3 branch we don't have a simple mean to know if a task has been modified since the last export. So right now the .txt wins on import. So as long as you modify different tasks on the desktop and the device, everything should be fine.

    If your -meta file is empty, that would show that there was an error when generating it (though it's a simple copy). On the other hand I just changed the way it's generated, so maybe you'll have more luck...

     
  • Jérome Laheurte

    And I'll update the documentation :)

     
  • Holzhauer

    Holzhauer - 2014-03-24

    Thank you. Ok, deleted tasks are not reimported from .txt again now, but removed tasks in .txt are not removed in Task Coach and editing is messy: if I add a task, save taskcoach, edit a task - say add due date - and save again the editing is overwritten by the .txt data (resulting in the task having no due date anymore).

    My .txt-meta contains only a single line ("VERSION: 1") (and a 2nd empty line). I don't see any error (is there some logging of such errors?).
    The .txt file now contains a tcid value which seems to be a good idea since it should allow the renaming of tasks and seems to be responsible for the fixed reimporting issue, but it still doesn't work correctly (s.o.).

    Re "since in the release 1.3 branch we don't have a simple mean to know if a task has been modified since the last export": am I right that this should read ...a simple mean to know when a task has been modified...?

    BTW: The requirements of twisted and zope are not reported at http://www.taskcoach.org/devinfo.html

     
  • Jérome Laheurte

    There's definitely something wrong there. The -meta file should contain as much tasks as your .task file. Could you try launching taskcoach_console.exe (in the installation dir) in a command line ? It should print errors (if there are ones) in the console.

    As for the task modification, I forgot there is a way by comparing the task's last modification time to the file's... Not sure this will play well with Dropbox/Google Drive though.

    I'll update the dev requirements, but since the Twisted one is new it's not applicable to the latest release yet.

     
  • Holzhauer

    Holzhauer - 2014-03-30

    I run taskcoach_console.exe of the newest release (1.3.37) on a command line. The .meta file still contains only "VERSION: 1" but I don't get any error messages on the commond line. Anything else I can do to identify the problem?

     
  • Jérome Laheurte

    I'm at loss. The .txt file itself is not empty, is it ?

     
  • Holzhauer

    Holzhauer - 2014-03-31

    No, the .txt file contains the tasks as in the taskcoach file.

     
  • Holzhauer

    Holzhauer - 2014-03-31

    Thank you very much. Writing .txt-meta works now (I only see messages
    == Writing tasks
    == Copying meta
    == Writing tasks
    == Removing old meta
    == Copying meta)
    The only thing I experienced to be still messy is the deletion of tasks in .txt: if I delete a task in .txt that task is not deleted in taskcoach after import.

     
  • Jérome Laheurte

    Okay, everything should be fixed in the latest build.

     
  • Jérome Laheurte

    A fix was made and checked into the source code repository of Task Coach. The fix will be part of the next release. You will get another notification when that release is available with the request to install the new release and confirm that your issue has indeed been fixed.

    If you like, you can download a recent build from http://www.fraca7.net/TaskCoach-packages/latest_bugfixes.py to test the fix.

    Because a fix has been made for this bug report, the priority of this report has been lowered to 1 and its resolution has been set to 'Fixed'.
    Thanks, Task Coach development team

     
  • Jérome Laheurte

    This bug should be fixed in the latest release of Task Coach. Can you please install the latest release of Task Coach and confirm that this bug has indeed been fixed?

    Thanks, Task Coach development team

     
1 2 > >> (Page 1 of 2)

Log in to post a comment.