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 loose: "if reducing the directory entry names
7 # within one directory to lowercase and 8.3-truncated causes
8 # conflicts, that's a bad thing". So the rule is NOT the strict
9 # "no filename shall be longer than eight and a suffix if present
10 # not longer than three".
12 # TODO: this doesn't actually check for *directory entries*, what this
13 # does is to check for *MANIFEST entries*, which are only files, not
14 # directories. In other words, a 8.3 conflict between a directory
15 # "abcdefghx" and a file "abcdefghy" wouldn't be noticed-- or even for
16 # a directory "abcdefgh" and a file "abcdefghy".
19 my ($dir, $base, $ext) = ($_[0] =~ m!^(?:(.+)/)?([^/.]+)(?:\.([^/.]+))?$!);
20 my $file = $base . defined $ext ? ".$ext" : "";
21 $base = substr($base, 0, 8);
22 $ext = substr($ext, 0, 3) if defined $ext;
24 warn "$dir: directory name contains '.'\n";
26 if ($file =~ /[^A-Za-z0-9\._-]/) {
27 warn "$file: filename contains non-portable characters\n";
29 if (length $file > 30) {
30 warn "$file: filename longer than 30 characters\n"; # make up a limit
33 return ($dir, defined $ext ? "$dir/$base.$ext" : "$dir/$base");
35 return ('.', defined $ext ? "$base.$ext" : $base);
41 if (open(MANIFEST, "MANIFEST")) {
50 print "$_: more than one dot\n";
53 my ($dir, $edt) = eight_dot_three($_);
54 ($dir, $edt) = map { lc } ($dir, $edt);
55 push @{$dir{$dir}->{$edt}}, $_;
58 die "$0: MANIFEST: $!\n";
61 for my $dir (sort keys %dir) {
62 for my $edt (keys %{$dir{$dir}}) {
63 my @files = @{$dir{$dir}->{$edt}};
65 print "@files: directory $dir conflict $edt\n";