X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=Porting%2Fcheck83.pl;h=71488ec8306bc48a3bb1efd7e8e9a54307bc62fb;hb=7d84b8ac5458b36428c44a53c4148b3abea83f2d;hp=7006d23c1fe87d961d5fb7ef7a88a083bfed97b1;hpb=9c406a46272accd6941f5f21f6abc86cdd476f41;p=p5sagit%2Fp5-mst-13.2.git diff --git a/Porting/check83.pl b/Porting/check83.pl index 7006d23..71488ec 100644 --- a/Porting/check83.pl +++ b/Porting/check83.pl @@ -1,4 +1,6 @@ -#!/usr/local/bin/perl +#!/usr/bin/perl -w + +use strict; # Check whether there are naming conflicts when names are truncated to # the DOSish case-ignoring 8.3 format, plus other portability no-nos. @@ -9,25 +11,23 @@ # "no filename shall be longer than eight and a suffix if present # not longer than three". -# TODO: this doesn't actually check for *directory entries*, what this -# does is to check for *MANIFEST entries*, which are only files, not -# directories. In other words, a 8.3 conflict between a directory -# "abcdefghx" and a file "abcdefghy" wouldn't be noticed-- or even for -# a directory "abcdefgh" and a file "abcdefghy". +my %seen; +my $maxl = 30; # make up a limit for a maximum filename length sub eight_dot_three { - my ($dir, $base, $ext) = ($_[0] =~ m!^(?:(.+)/)?([^/.]+)(?:\.([^/.]+))?$!); - my $file = $base . defined $ext ? ".$ext" : ""; + return () if $seen{$_[0]}++; + my ($dir, $base, $ext) = ($_[0] =~ m{^(?:(.+)/)?([^/.]+)(?:\.([^/.]+))?$}); + my $file = $base . ( defined $ext ? ".$ext" : "" ); $base = substr($base, 0, 8); $ext = substr($ext, 0, 3) if defined $ext; - if ($dir =~ /\./) { - warn "$dir: directory name contains '.'\n"; + if (defined $dir && $dir =~ /\./) { + print "directory name contains '.': $dir\n"; } if ($file =~ /[^A-Za-z0-9\._-]/) { - warn "$file: filename contains non-portable characters\n"; + print "filename contains non-portable characters: $_[0]\n"; } - if (length $file > 30) { - warn "$file: filename longer than 30 characters\n"; # make up a limit + if (length $file > $maxl) { + print "filename longer than $maxl characters: $file\n"; } if (defined $dir) { return ($dir, defined $ext ? "$dir/$base.$ext" : "$dir/$base"); @@ -43,16 +43,19 @@ if (open(MANIFEST, "MANIFEST")) { chomp; s/\s.+//; unless (-f) { - warn "$_: missing\n"; + print "missing: $_\n"; next; } if (tr/././ > 1) { - print "$_: more than one dot\n"; + print "more than one dot: $_\n"; next; } - my ($dir, $edt) = eight_dot_three($_); - ($dir, $edt) = map { lc } ($dir, $edt); - push @{$dir{$dir}->{$edt}}, $_; + while (m!/|\z!g) { + my ($dir, $edt) = eight_dot_three($`); + next unless defined $dir; + ($dir, $edt) = map { lc } ($dir, $edt); + push @{$dir{$dir}->{$edt}}, $_; + } } } else { die "$0: MANIFEST: $!\n"; @@ -60,9 +63,9 @@ if (open(MANIFEST, "MANIFEST")) { for my $dir (sort keys %dir) { for my $edt (keys %{$dir{$dir}}) { - my @files = @{$dir{$dir}->{$edt}}; + my @files = @{$dir{$dir}{$edt}}; if (@files > 1) { - print "@files: directory $dir conflict $edt\n"; + print "conflict on filename $edt:\n", map " $_\n", @files; } } }