1,$directive_file_contents);
my $val = $1; # so far so good
+ my @dirs = File::Spec::Unix->splitdir($1);
+ my $dir_depth = scalar @dirs;
+
# A couple of subdir levels are ok, but don't allow hundreds.
- my $slash_count = ($val =~ tr,/,/,);
- fatal("$slash_count slashes is too many, in $val",1,$directive_file_contents)
- if ($slash_count > (MAX_DIRECTORY_DEPTH-1) and not $do_not_fail);
+ fatal("$dir_depth levels is too deep, in $val",1,$directive_file_contents)
+ if ($dir_depth > MAX_DIRECTORY_DEPTH and not $do_not_fail);
# Only let them specify one directory directive.
fatal("Only one directory directive is allowed per directive file. "
exp_continue
}
-re {^gatekeeper\[[0-9]+\]: \(Test\)\
- ([0-9]+) slashes is too many, in [^\r\n]+} {
+ ([0-9]+) levels is too deep, in [^\r\n]+} {
# from parse_directory_line, when the directory is too deep
set A(validate,bad-directory-depth) 1
set A(validate,bad-directory-depth,$expect_out(1,string)) 1