From 5eae528662318193cf51856362b5b6c01a376638 Mon Sep 17 00:00:00 2001 From: tony mancill Date: Wed, 4 Jan 2023 21:23:35 -0800 Subject: [PATCH] Don't try to open a directory as the config file This patches load_configs() to check that the $config being opened is actually a file and not a directory, which was tripping up the tests that assert that there is an error when the config file cannot be written because a directory already exists. Until recently, the attempt to read the directory as a file was being silently ignored due to a latent bug in Perl; more about that here: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1016369 and https://github.com/Perl/perl5/pull/20103 This addresses a bug filed against the Debian package for clusterssh when t/15config.t tests started failing after the Perl bug was fixed. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1026735 --- lib/App/ClusterSSH/Config.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/App/ClusterSSH/Config.pm b/lib/App/ClusterSSH/Config.pm index 75fd04d..f66b2d4 100644 --- a/lib/App/ClusterSSH/Config.pm +++ b/lib/App/ClusterSSH/Config.pm @@ -314,7 +314,7 @@ sub load_configs { $ENV{HOME} . '/.clusterssh/config', ) { - $self->parse_config_file($config) if ( -e $config ); + $self->parse_config_file($config) if ( -e $config && ! -d _ ); } # write out default config file if necesasry @@ -329,10 +329,10 @@ sub load_configs { # relative to config directory for my $config (@configs) { next unless ($config); # can be null when passed from Getopt::Long - $self->parse_config_file($config) if ( -e $config ); + $self->parse_config_file($config) if ( -e $config && ! -d _ ); my $file = $ENV{HOME} . '/.clusterssh/config_' . $config; - $self->parse_config_file($file) if ( -e $file ); + $self->parse_config_file($file) if ( -e $file && ! -d _ ); } return $self;