RexOps / RexOps/Rex

needs: syntax error under v5.36 (indirect)

Open
#1,543 1 comment 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

Calling needs command with the indirect syntax described by its documentation fails with syntax error:

/usr/bin/perlbrew exec -q --with perl-5.36.0 /home/regular/perl5/perlbrew/perls/perl-5.36.0/bin/perl /home/regular/perl5/perlbrew/perls/latest/bin/rex one
[2022-08-24 12:37:14] ERROR - Compile time errors:
[2022-08-24 12:37:14] ERROR -   syntax error at __Rexfile__.pm line 9, near "main 'one'"
[2022-08-24 12:37:14] ERROR -   Compilation failed in require at /home/regular/perl5/perlbrew/perls/perl-5.36.0/lib/site_perl/5.36.0/Rex/CLI.pm line 759.
[2022-08-24 12:37:14] INFO - Exiting Rex...
[2022-08-24 12:37:14] INFO - Cleaning up...
Expected behavior

[2022-08-24 13:43:10] INFO - Running task one on
hello from one
[2022-08-24 13:43:11] INFO - All tasks successful on all hosts

Process finished with exit code 0

Success (as achievable with use feature 'indirect';)

How to reproduce it

Call needs with indirect syntax.

See the code example.

Code example
use v5.36;
use Rex -feature => [ '1.4' ];

task 'one', sub {
  say 'hello from one';
};

task 'two', sub {
  needs main 'one';
  say 'hello from two';
};
Additional context

https://github.com/RexOps/Rex/issues/1542

https://github.com/RexOps/Rex/discussions/1538

Rex version

1.13.4

Perl version

5.36.0

Operating system running rex

Debian

Operating system managed by rex

FreeBSD

How rex was installed?

cpan client

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

Reproduce the failure with the provided Rexfile example under Perl 5.36, then inspect the needs command implementation and the compilation path around Rex::CLI.pm line 759. Done means the documented indirect syntax compiles without requiring use feature 'indirect' and the dependent task runs successfully.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.