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".
14 # The 8-level depth rule is for older VMS systems that likely won't
15 # even be able to unpack the tarball if more than eight levels
16 # (including the top of the source tree) are present.
19 my $maxl = 30; # make up a limit for a maximum filename length
22 return () if $seen{$_[0]}++;
23 my ($dir, $base, $ext) = ($_[0] =~ m{^(?:(.+)/)?([^/.]+)(?:\.([^/.]+))?$});
24 my $file = $base . ( defined $ext ? ".$ext" : "" );
25 $base = substr($base, 0, 8);
26 $ext = substr($ext, 0, 3) if defined $ext;
27 if (defined $dir && $dir =~ /\./) {
28 print "directory name contains '.': $dir\n";
30 if ($file =~ /[^A-Za-z0-9\._-]/) {
31 print "filename contains non-portable characters: $_[0]\n";
33 if (length $file > $maxl) {
34 print "filename longer than $maxl characters: $file\n";
37 return ($dir, defined $ext ? "$dir/$base.$ext" : "$dir/$base");
39 return ('.', defined $ext ? "$base.$ext" : $base);
45 if (open(MANIFEST, "MANIFEST")) {
50 print "missing: $_\n";
54 print "more than one dot: $_\n";
57 if ((my $slashes = $_ =~ tr|\/|\/|) > 7) {
58 print "more than eight levels deep: $_\n";
62 my ($dir, $edt) = eight_dot_three($`);
63 next unless defined $dir;
64 ($dir, $edt) = map { lc } ($dir, $edt);
65 push @{$dir{$dir}->{$edt}}, $_;
69 die "$0: MANIFEST: $!\n";
72 for my $dir (sort keys %dir) {
73 for my $edt (keys %{$dir{$dir}}) {
74 my @files = @{$dir{$dir}{$edt}};
76 print "conflict on filename $edt:\n", map " $_\n", @files;