#2573: Cactus treats a directory "configs/FOO/ThornList" as an empty thornlist file
Reporter:Roland Haas
Status:new
Milestone:
Version:development version
Type:bug
Priority:minor
Component:Cactus

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 t

--
Ticket URL: https://bitbucket.org/einsteintoolkit/tickets/issues/2573/cactus-treats-a-directory-configs-foo