todo.txt-cli
todo.txt-cli copied to clipboard
todo.txt inode changing - using symlinked or hardlinked todo.txt not possible
Do you want to request a feature or report a bug? bug
What is the current behavior? If I symlink or hardlink a file to ~/.todo-txt/todo.txt and then use todotxt-cli to modify it, the inode of the file changes (when hardlinked) or the symlinked file is replaced by a new file.
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.
- Create a todo list file, e.g.
touch ~/.todo-txt/test.txt
- Link it to todo.txt (
ln -s ~/.todo-txt/test.txt ~/.todo-txt/todo.txt
) - Add an entry (
todotxt add "a new entry"
) - Check if todo.txt is still symlinked to test.txt or
- Create a todo list file, e.g.
touch ~/.todo-txt/test.txt
- Link it to todo.txt (
ln ~/.todo-txt/test.txt ~/.todo-txt/todo.txt
) - Check inodes are the same (
ls -i ~/.todo-txt/test.txt
andls -i ~/.todo-txt/todo.txt
- Add an entry (todotxt add "a new entry")
- Check inodes are the same (
ls -i ~/.todo-txt/test.txt
andls -i ~/.todo-txt/todo.txt
What is the expected behavior? I would expect the symlink or hardlink to remain
Which versions todo.sh are you using?
Run
todo.sh -V
The command istodotxt-cli -V
on my Ubuntu and it returns the following:
First release: 5/11/2006
Original conception by: Gina Trapani (http://ginatrapani.org)
Contributors: http://github.com/ginatrapani/todo.txt-cli/network
License: GPL, http://www.gnu.org/copyleft/gpl.html
More information and mailing list at http://todotxt.com
Code repository: http://github.com/ginatrapani/todo.txt-cli/tree/master
Which Operating System are you using? Ubuntu 18.04.2 LTS
Which version of bash are you using?
Run
bash --version
GNU bash, version 4.4.19(1)-release (x86_64-pc-linux-gnu)
The (very useful) functionality to keep a backup copy (in todo.txt this is implemented via sed -i.bak
) in case something goes wrong changes the inode number. I think many applications do this (e.g. Vim), and having a guarantee to maintain the inode is rare.
Now for symbolic links, I think todo.txt would have to resolve the link target (readlink -nf
) to avoid breaking it. This could be implemented, but it raises compatibility issues (what if there's no readlink
installed?)
What many people do (and what works very well) is linking the todo.txt directory instead of individual files. As there's a close connection between files (e.g. archived tasks go into done.txt
), I think this setup also makes a lot more sense. Wouldn't this approach work for you, too?!
Thanks for the quick response.
I wasn't aware that this is expected behaviour. So basically, you rename the todo.txt file to todo.txt.bak and create a new todo.txt file.
Linking the directory would be a possibility, which I will try out. I just would have preferred linking the individual files, since I've other stuff in there too.
I find the way it works counter-intuitive, but maybe I'm alone there.