5 # Check whether there are naming conflicts when names are truncated to
6 # the DOSish case-ignoring 8.3 format, plus other portability no-nos.
8 # The "8.3 rule" is loose: "if reducing the directory entry names
9 # within one directory to lowercase and 8.3-truncated causes
10 # conflicts, that's a bad thing". So the rule is NOT the strict
11 # "no filename shall be longer than eight and a suffix if present
12 # not longer than three".
15 my $maxl = 30; # make up a limit for a maximum filename length
18 return () if $seen{$_[0]}++;
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;
23 if (defined $dir && $dir =~ /\./) {
24 print "directory name contains '.': $dir\n";
26 if ($file =~ /[^A-Za-z0-9\._-]/) {
27 print "filename contains non-portable characters: $_[0]\n";
29 if (length $file > $maxl) {
30 print "filename longer than $maxl characters: $file\n";
33 return ($dir, defined $ext ? "$dir/$base.$ext" : "$dir/$base");
35 return ('.', defined $ext ? "$base.$ext" : $base);
41 if (open(MANIFEST, "MANIFEST")) {
46 print "missing: $_\n";
50 print "more than one dot: $_\n";
54 my ($dir, $edt) = eight_dot_three($`);
55 next unless defined $dir;
56 ($dir, $edt) = map { lc } ($dir, $edt);
57 push @{$dir{$dir}->{$edt}}, $_;
61 die "$0: MANIFEST: $!\n";
64 for my $dir (sort keys %dir) {
65 for my $edt (keys %{$dir{$dir}}) {
66 my @files = @{$dir{$dir}->{$edt}};
68 print "directory $dir conflict $edt: @files\n";