Open echo-bravo-yahoo opened 2 months ago
I don't know much about contexts, but this does work for me. As the vim ~/.taskrc
suggests, task context define
just adds some lines to .taskrc
. Is it not adding them, or are they not being interpreted correctly?
They were not being added (despite the command exiting successfully). I can't reproduce on this computer, will try again tonight on the other computer. I did end up making this tiny test harness, though, that might be helpful for some people to generate minimal repros:
mkdir ~/.task-debug && \
echo -e "data.location=~/.task-debug\nnews.version=3.1.0" >> ~/.taskrc-debug && \
TASKRC=~/.taskrc-debug task list
Is the .taskrc
writeable? I see a link to #3613 where .taskrc
appears to be read-only, so worth asking.
If the .taskrc
modification fails silently, that would be a bug!
I actually can't find any migration docs - what sent me down this rabbit hole in the first place was wanting to migrate my contexts to the newer definition style
I didn't realize there was any migration to do. What is the "older definition style"? As I said, I don't know much about contexts!
File: /Users/.../.taskrc (found), 5192 bytes, mode 100644
I can't figure out what that 1
means. It's not in chmod(2)
on my system..
So, "old" contexts look like:
context.home=project:home
Taskwarrior appears to convert this internally to a "new" context with only its read behavior defined:
context.home.read=project:home
context.home.write=
If I wanted newly-created tasks in this context to have certain properties, I could edit it to be:
context.home.read=project:home
context.home.write=project:home priority:L
This isn't really documented anywhere I could find, so I've sort of sussed this out from interacting with it on several computers with several versions of taskwarrior.
Maybe this is a WSL/linux permission intersection issue? The computer that was not behaving well was ubuntu-in-windows; maybe @martiege has a similar setup?
Oh, intersting --
Version: Apple LLVM 15.0.0 (clang-1500.3.9.4)
had me assuming this was a mac..
A PR to add documentation for those formats, either to the manpages here, or to https://github.com/GothenburgBitFactory/tw.org, would be great!
Ah, sorry - I recently migrated to taskwarrior 3 on a linux computer, a WSL computer, a mac, and an android phone, and the issues I was having were either on the mac or the WSL computer, but neither are reproducible now (I just checked the WSL setup, and it's working fine) and I grabbed the logs from the mac.
This is especially perplexing because I version control my taskrc, and I rolled it backwards/forwards and couldn't get it to repro at any recent commit...
I think this issue can probably be closed for now (can't repro, can't fix, and i'm unblocked). I'll take a look at the docs site for contexts and see if I can get a PR up sometime soon. Thanks!
~/w/wildflower/valley main !2 ❯ ls -la ~/.taskrc
-rw-r--r-- 1 foo foo 5192 Aug 30 16:06 /home/foo/.taskrc
~/w/wildflower/valley main !2 ❯ chmod -w ~/.taskrc
~/w/wildflower/valley main !2 ❯ t context define test +test
Are you sure you want to add 'context.test.read' with a value of '+test'? (yes/no) y
Are you sure you want to add 'context.test.write' with a value of '+test'? (yes/no) y
Context 'test' defined (read, write). Use 'task context test' to activate.
~/w/wildflower/valley main !2 ❯ echo $?
0
~/w/wildflower/valley main !2 ❯ t context test
Context 'test' not found.
~/w/wildflower/valley main !2 ❯ chmod +w ~/.taskrc
~/w/wildflower/valley main !2 ❯ t context define test +test
Are you sure you want to add 'context.test.read' with a value of '+test'? (yes/no) y
Are you sure you want to add 'context.test.write' with a value of '+test'? (yes/no) y
Context 'test' defined (read, write). Use 'task context test' to activate.
~/w/wildflower/valley main !2 ❯ t context test
Context 'test' set. Use 'task context none' to remove.
Ok, so there definitely is a "fails silently" bug here. figured since the repro was easy enough i'd test it, and sure enough... :)
OK, nice! I can repro that too, with the simpler task config
:
⸩ chmod -w .taskrc
⸩ echo foo=bar >> .taskrc
bash: .taskrc: Permission denied
⸩ task config foo bar
Are you sure you want to add 'foo' with a value of 'bar'? (yes/no) yes
TASKRC override: /home/dustin/p/taskwarrior/.taskrc
Config file /home/dustin/p/taskwarrior/.taskrc modified.
⸩ grep foo= .taskrc
⸩
I'll mark this as a bug and add it to the backlog.
@echo-bravo-yahoo it might be related yeah, as I only seem to experience the issue when I include a symlinked and read-only file, though I'm running nixos natively and not through wsl or anything. I'll check what permissions are given, but it still seems strange to me that the behaviour seems so random.
I raised a PR to address silent fails on modification of the .taskrc file.
Thanks @gagankonana.
@martiege or @echo-bravo-yahoo, do you have the capability to compile locally and verify that @gagankonana's fix has addressed the issue?
I don't appear to be able to create contexts in v3.1.0 from the CLI. Some other useful information: