GothenburgBitFactory / GothenburgBitFactory/taskwarrior
Define a context with an invalid modification string
- Dominant language
- C++
- Stars
- 6.1k
- Forks
- 423
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 11
Description
### Description
I was looking for a way to automatically add tags based on the context you are in and I found [this](https://www.reddit.com/r/taskwarrior/comments/q2vb0f/having_trouble_with_contexts_in_260/) thread, specifically [this](https://www.reddit.com/r/taskwarrior/comments/q2vb0f/comment/hfs9d9f/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button) comment, which denotes a bug not fixed yet and as of my search not reported either. The issue is three years old now, but the behaviour is still there:
If the modification string provided to define a context is given in one token, i.e. surrounded by quotes, and contains the OR operator, which is invalid here, the write context is still set with no warnings, and you end up messing up your tasks added in there.
> When I then run task, I see the newly added task has prepended multiple instances of 'or' from the context definition to the description, one for each tag added to the task:
> `or or this is a test`
>
> The task has three tags set, as expected:
`home personal work`
> EDIT: This is indeed a bug. If you omit the quotes around the context definition, you get a warning, and the write context will not be set
### Specifications
- Taskwarrior 2.6.2, 3.3.0.
### Steps to reproduce
1. Run `task context define mine +personal or +home or +work`;
2. Notice that the write context is not set and the warning «not a valid modification string, because it contains the OR operator» so that the user sets it manually;
3. Run `task context define mine "+personal or +home or +work"`;
4. Notice that the write context is set and no warning appear.
Contributor guide
Assessment
This issue has not been assessed yet.