Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define a context with an invalid modification string #3760

Open
duartemtorres opened this issue Jan 20, 2025 · 1 comment
Open

Define a context with an invalid modification string #3760

duartemtorres opened this issue Jan 20, 2025 · 1 comment
Labels
topic:command-line topic:context Issues relatd to context type:bug Something isn't working

Comments

@duartemtorres
Copy link

Description

I was looking for a way to automatically add tags based on the context you are in and I found this thread, specifically this 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.
@djmitche
Copy link
Collaborator

Hm, I wonder if this is related to command-line parsing and possibly applying shell work-breaking too few or too many times?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic:command-line topic:context Issues relatd to context type:bug Something isn't working
Projects
Status: Backlog
Development

No branches or pull requests

2 participants