From 037b3bba6fd6b18b43e7c6acb2b288fe1692251b Mon Sep 17 00:00:00 2001 From: Patrice Clement Date: Wed, 13 Oct 2021 18:45:41 +0200 Subject: [PATCH] Avoid slurping with <> during compile time --- lib/Rex/Config.pm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/Rex/Config.pm b/lib/Rex/Config.pm index 7fad60ab5..313128cd5 100644 --- a/lib/Rex/Config.pm +++ b/lib/Rex/Config.pm @@ -1739,7 +1739,11 @@ sub read_config_file { $config_file ||= _home_dir() . "/.rex/config.yml"; if ( -f $config_file ) { - my $yaml = eval { local ( @ARGV, $/ ) = ($config_file); <>; }; + my $yaml = do { + use IO::File; + my $fh = IO::File->new( $config_file, 'r' ); + join '', $fh->getlines(); + }; eval { $HOME_CONFIG_YAML = Load($yaml); }; if ($@) { @@ -1762,7 +1766,11 @@ sub read_ssh_config_file { $config_file ||= _home_dir() . '/.ssh/config'; if ( -f $config_file ) { - my @lines = eval { local (@ARGV) = ($config_file); <>; }; + my @lines = do { + use IO::File; + my $fh = IO::File->new( $config_file, 'r' ); + join '', $fh->getlines(); + }; %SSH_CONFIG_FOR = _parse_ssh_config(@lines); } }