3 # Check whether there are naming conflicts when names are truncated to
4 # the DOSish case-ignoring 8.3 format, plus other portability no-nos.
6 # The "8.3 rule" is "if reducing the directory entry names within one
7 # directory to lowercase and 8.3-truncated causes conflicts, that's
8 # a bad thing". So the rule is NOT "no filename shall be longer
9 # than eight and a suffix if present not longer than three".
11 # TODO: this doesn't actually check for *directory entries*, what
12 # this does is to check for *MANIFES entries*, which are only files,
13 # not directories. In other words, a conflict between a directory
14 # "abcdefghx" and a file "abcdefghy" wouldn't be noticed-- or even
15 # for a directory "abcdefgh" and a file "abcdefghy".
18 my ($dir, $base, $ext) = ($_[0] =~ m!^(?:(.+)/)?([^/.]+)(?:\.([^/.]+))?$!);
19 my $file = $base . defined $ext ? ".$ext" : "";
20 $base = substr($base, 0, 8);
21 $ext = substr($ext, 0, 3) if defined $ext;
23 warn "$dir: directory name contains '.'\n";
25 if ($file =~ /[^A-Za-z0-9\._-]/) {
26 warn "$file: filename contains non-portable characters\n";
28 if (length $file > 30) {
29 warn "$file: filename longer than 30 characters\n";
32 return ($dir, defined $ext ? "$dir/$base.$ext" : "$dir/$base");
34 return ('.', defined $ext ? "$base.$ext" : $base);
40 if (open(MANIFEST, "MANIFEST")) {
49 print "$_: more than one dot\n";
52 my ($dir, $edt) = eight_dot_three($_);
53 ($dir, $edt) = map { lc } ($dir, $edt);
54 push @{$dir{$dir}->{$edt}}, $_;
57 die "$0: MANIFEST: $!\n";
60 for my $dir (sort keys %dir) {
61 for my $edt (keys %{$dir{$dir}}) {
62 my @files = @{$dir{$dir}->{$edt}};
64 print "@files: directory $dir conflict $edt\n";