[ET Trac] #2573: Cactus treats a directory "configs/FOO/ThornList" as an empty thornlist file

Roland Haas trac-noreply at einsteintoolkit.org
Mon Nov 1 13:08:30 CDT 2021


#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.

```perl
#!/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:

```perl
-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.

--
Ticket URL: https://bitbucket.org/einsteintoolkit/tickets/issues/2573/cactus-treats-a-directory-configs-foo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.einsteintoolkit.org/pipermail/trac/attachments/20211101/ecdc040e/attachment.html 


More information about the Trac mailing list