From 959402cef8e16f371430119ee7b8175135274d06 Mon Sep 17 00:00:00 2001 From: Andy Whitcroft Date: Wed, 15 Oct 2008 22:02:21 -0700 Subject: [PATCH] --- yaml --- r: 114759 b: refs/heads/master c: 6ecd967444223cea4a02d55fdc0f0510baa69523 h: refs/heads/master i: 114757: 01c5408b8630e0a15a181643d7ad453dc3b1ec8d 114755: af71cf8ee672431a74864852d78fdca3e6e7a8c5 114751: 02a2391690670d09d4a156ed908fd246f1fce6e2 v: v3 --- [refs] | 2 +- trunk/scripts/checkpatch.pl | 41 +++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 41d524aa54c0..8b1fad301035 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: e09dec4831bbb319987215ea0a280b2a620021b7 +refs/heads/master: 6ecd967444223cea4a02d55fdc0f0510baa69523 diff --git a/trunk/scripts/checkpatch.pl b/trunk/scripts/checkpatch.pl index 9e7e9d1d5958..cc61cf7187ef 100755 --- a/trunk/scripts/checkpatch.pl +++ b/trunk/scripts/checkpatch.pl @@ -958,6 +958,33 @@ sub CHK { } } +sub check_absolute_file { + my ($absolute, $herecurr) = @_; + my $file = $absolute; + + ##print "absolute<$absolute>\n"; + + # See if any suffix of this path is a path within the tree. + while ($file =~ s@^[^/]*/@@) { + if (-f "$root/$file") { + ##print "file<$file>\n"; + last; + } + } + if (! -f _) { + return 0; + } + + # It is, so see if the prefix is acceptable. + my $prefix = $absolute; + substr($prefix, -length($file)) = ''; + + ##print "prefix<$prefix>\n"; + if ($prefix ne ".../") { + WARN("use relative pathname instead of absolute in changelog text\n" . $herecurr); + } +} + sub process { my $filename = shift; @@ -1168,6 +1195,20 @@ sub process { $herecurr) if (!$emitted_corrupt++); } +# Check for absolute kernel paths. + if ($tree) { + while ($line =~ m{(?:^|\s)(/\S*)}g) { + my $file = $1; + + if ($file =~ m{^(.*?)(?::\d+)+:?$} && + check_absolute_file($1, $herecurr)) { + # + } else { + check_absolute_file($file, $herecurr); + } + } + } + # UTF-8 regex found at http://www.w3.org/International/questions/qa-forms-utf-8.en.php if (($realfile =~ /^$/ || $line =~ /^\+/) && $rawline !~ m/^$UTF8*$/) {