Call to "get cmdb" on Darwin outside of a task throws bash error
Nobody has claimed this yet.
- Dominant language
- Perl
- Stars
- 737
- Forks
- 214
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
Following bash message is shown twice on STDERR:
sh: free: command not found
How to reproduce it
Steps to reproduce the behavior:
- Add the following code in the main body of a Rexfile outside of a task:
get cmdb()
Shortest code example that demonstrates the bug:
use Rex -feature => [ qw( 1.4 ) ];
get cmdb();
task test => sub {
};
1;
Expected behavior
No error.
Circumstances
- Rex version: 11
- Perl version: 5.24.4
- OS running rex: Darwin (Catalina, 10.15.5)
- OS managed by rex: Darwin
Other
The error can be hacked around by change commenting out this line in Rex/Hardware/Memory:
https://github.com/RexOps/Rex/blob/master/lib/Rex/Hardware/Memory.pm#L193
and replace with:
$free_str = '';
The same hack needs to be done to the line at: https://github.com/RexOps/Rex/blob/master/lib/Rex/Hardware/Swap.pm#L143
Obviously these are not proper fixes and are provided here to help pinpoint the problem.
Finally, the bug does not occur when get cmdb() is called from inside a task.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the provided Rexfile on Darwin, then read lib/Rex/Hardware/Memory.pm around line 193 and lib/Rex/Hardware/Swap.pm around line 143. Compare the behavior of get cmdb() outside and inside a task. Done means the outside-task call completes without emitting the repeated free: command not found error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- perl
- Domain
- devops, operating-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100