RexOps / Rex

Rex, the friendly automation framework
https://www.rexify.org
716 stars 223 forks source link

Error "deep recursion subroutine" when using md5 #1060

Closed rapenne-s closed 8 years ago

rapenne-s commented 8 years ago

Hello,

I am new to Rex, maybe I did something wrong. I am using 1.4.0.

Here is my Rexfile and I start it with "rex md5". (rex uptime works correctly)

use Rex -feature => ['1.4'];
user "solene";
group freebsd => "***";

desc "The uptime";
task "uptime", group => "freebsd", sub {
    my $output = run "uptime";
    say $output;
};

desc "md5 test";
task "md5", group => "freebsd" , sub {
    my $md5 = md5("/home/solene/.profile");
    say $md5;
};

I get a never ending output with an error in the firsts lines

[2016-06-29 17:40:44] INFO - Running task md5 on ****
[2016-06-29 17:40:45] INFO - Running task md5 on current connection
[this is repeated a lot of time and infinitely]
Deep recursion on subroutine "Rex::Task::run" at /usr/local/libdata/perl5/site_perl/Rex/Commands.pm line 347, <> line 51.
Deep recursion on subroutine "Rex::Interface::Executor::Default::exec" at /usr/local/libdata/perl5/site_perl/Rex/Task.pm line 869, <> line 51.
Deep recursion on anonymous subroutine at /usr/local/libdata/perl5/site_perl/Rex/Interface/Executor/Default.pm line 58, <> line 51.
[2016-06-29 17:40:45] INFO - Running task md5 on current connection
[...]
krimdomu commented 8 years ago

Hi @rapenne-s ,

the problem is, that your task is named like a function. Please rename your task, then it should work.

HTH, Jan

rapenne-s commented 8 years ago

The problem is solved when renaming the task. Isn't it possible to detect it to prevent this kind of error ?

Regards

ipcjk commented 8 years ago

Then our example is wrong: https://www.rexify.org/docs/api/1.4/rex/commands/md5.pm.html

krimdomu commented 8 years ago

@ipcjk good catch

ferki commented 8 years ago

@rapenne-s: yes, #467 is about warn when task names conflict with rex function names. @ipcjk: nice, thanks!

ferki commented 8 years ago

Fixed md5 example on 0cf4ff43ab04bdce0307e36a7dd2b728e5e07730