RexOps / RexOps/Rex

Confusing results when calling run_task on undefined target

Open
#1,463 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Perl
Stars
737
Forks
214
PR merge metrics
No merged PRs in 30d

Description

Describe the bug

When calling my $return = run_task $task, on => undef;, the value of $return is always 1.

(Originally reported by @sdondley via IRC, thanks!)

How to reproduce it

Steps to reproduce the behavior:

  1. Call run_task with on => undef.

Shortest code example that demonstrates the bug:

task 'abc', sub {
  return 'abc';
};

task 'run_task_undef', sub {
  my $return = run_task 'abc', on => undef;
  say $return;
};

Expected behavior

While a task's returned value might not be well-defined, it would be nice to have as consistent behavior as possible between the various calls. In this case, returning "abc" instead of 1.

Currently run_task $task, on => undef seems to execute on the same target as the calling task, which might be confusing and/or error-prone. Perhaps it's best to die() with an error message in this case.

Circumstances

  • Rex version: current master
  • Perl version: 5.32.0
  • OS running rex: Gentoo
  • OS managed by rex: Gentoo
  • How rex was installed: dzil install

Debug log

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the minimal Perl reproduction in the issue and trace run_task when called with on => undef. Compare its return behavior with related task calls, then determine whether the intended result is a consistent returned value or an explicit error and add coverage for this case.

Written by the indexing model from the issue text.

Assessment

Tech stack
perl
Domain
devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.