duncs / clusterssh

Cluster SSH - Cluster Admin Via SSH
https://github.com/duncs/clusterssh/wiki
890 stars 79 forks source link

Don't try to open a directory as the config file #150

Closed tmancill closed 1 year ago

tmancill commented 1 year ago

This PR patches load_configs() to check that the $config being opened is actually (well, likely) 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 in Debian bug report 10163690 and Perl 5 issue 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

The -e $config && ! -d _ file test operators are used instead of -e $config && -f _ because it will still support users who might want to symlink their config file.