After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 779979 - todo.txt doesn't create the source file if it has been deleted.
todo.txt doesn't create the source file if it has been deleted.
Status: RESOLVED FIXED
Product: gnome-todo
Classification: Other
Component: General
unspecified
Other Linux
: Normal normal
: ---
Assigned To: GNOME To Do maintainer(s)
GNOME To Do maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2017-03-13 13:32 UTC by Rohit Kaushik
Modified: 2017-03-29 21:44 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Todo.txt plugin: Create the source file if it is deleted (3.39 KB, patch)
2017-03-13 14:35 UTC, Rohit Kaushik
none Details | Review
todo-txt: create source file if it is deleted (3.39 KB, patch)
2017-03-18 00:41 UTC, Georges Basile Stavracas Neto
committed Details | Review
todo.txt-plugin: Handle user deletion of todo.txt while To Do is running (2.71 KB, patch)
2017-03-23 20:33 UTC, Rohit Kaushik
committed Details | Review

Description Rohit Kaushik 2017-03-13 13:32:39 UTC
Steps to reproduce.
1) Select some todo.txt in To Do.
2) Close To Do and then delete the todo.txt selected.
3) Open To Do.
Todo gives an error as although the source uri is still stored but the file doesn't exist.

Possible Solution:
Check whether todo.txt file actually exist if not create it.
Comment 1 Rohit Kaushik 2017-03-13 14:35:11 UTC
Created attachment 347838 [details] [review]
Todo.txt plugin: Create the source file if it is deleted

This fixes the issue if the source_file that is being used is deleted by the user
when ToDo is not running, in which case earlier would have given an error as
although the source contains the uri to the file but the file is now present at the location.
The fix is to check if file exists and if not create one.
Comment 2 Georges Basile Stavracas Neto 2017-03-18 00:39:44 UTC
Review of attachment 347838 [details] [review]:

Looks good.
Comment 3 Georges Basile Stavracas Neto 2017-03-18 00:41:04 UTC
Created attachment 348211 [details] [review]
todo-txt: create source file if it is deleted

This fixes the issue if the source_file that is being used is
deleted by the user when To Do is not running, in which case
earlier would have given an error as although the source contains
the uri to the file but the file is now present at the location.

The fix is to check if file exists and if not create one.
Comment 4 Georges Basile Stavracas Neto 2017-03-18 00:42:00 UTC
Comment on attachment 348211 [details] [review]
todo-txt: create source file if it is deleted

I rewrote the commit message. Please try to follow this style next time.
Comment 5 Georges Basile Stavracas Neto 2017-03-18 00:43:38 UTC
Attachment 348211 [details] pushed as 2369228 - todo-txt: create source file if it is deleted
Comment 6 Rohit Kaushik 2017-03-23 20:33:15 UTC
Created attachment 348605 [details] [review]
todo.txt-plugin: Handle user deletion of todo.txt while To Do is running

Deletion of todo.txt by user while To Do is running causes a
segmentation fault error.

The problem is G_FILE_MONITOR_EVENT_DELETED was not handled
separately in the gtd_plugin_todo_txt_monitor_source which
causes issue as source_file doesn't points to a valid file
as it has been deleted by user.

The fix is handled G_FILE_MONITOR_EVENT_DELETED handle
separately and create a new file at same path as earlier
and assign it to source_file.
Comment 7 Georges Basile Stavracas Neto 2017-03-29 21:43:31 UTC
Review of attachment 348605 [details] [review]:

LGTM (and the commit message is fine!)
Comment 8 Georges Basile Stavracas Neto 2017-03-29 21:44:04 UTC
Thanks for the patch.