Cactus treats a directory "configs/FOO/ThornList" as an empty thornlist file
Issue #2573
new
Perl lets one open a directory with the regular open
command but then reports no content in it ie it shows up as an empty file. Eg.
#!/usr/bin/perl
use strict;
use warnings;
open(my $FH, "<", "empty") or die;
print "$FH\n";
while(<$FH>) {
print $_;
}
close $FH;
will work without error after a mkdir empty
.
The suggested solution seems to be to use Perl’s -f
operator to check for file type first. Eg something like:
-f "empty" && open(my $FH, "<", "empty") or die;
which I verified to fail if empty is a directory or a symbolic link to a directory but works fine for files and symbolic links to files.
This actually happened to someone “in the wild”, so it not quite hypothetical.