[Ksummit-discuss] [MAINTAINERS SUMMIT] API replacement/deprecation

Dan Carpenter dan.carpenter at oracle.com
Fri Sep 7 10:14:18 UTC 2018


On Fri, Sep 07, 2018 at 09:18:42AM +1000, Stephen Rothwell wrote:
> Hi Kees,
> 
> On Thu, 6 Sep 2018 11:24:11 -0700 Kees Cook <keescook at chromium.org> wrote:
> >
> > If there was an agreement by all maintainers that deprecated
> > functions/patterns should not be added, and we documented the
> > deprecation somewhere like Documentation/process/deprecated.rst, then
> > we could make the declaration that if such functions got added (it's
> > easy to mechanically check for them), it would be the responsibility
> > of the author and maintainer chain to see that it got fixed before the
> > release is cut. We already have this for things like "breaks the x86
> > allmodconfig build" or similar. The checking would be manual, and the
> > enforcement would be by agreement, but it'd be better than the kind of
> > "please don't do this" hand-waving we've had in the past.
> 
> I could do this in linux-next, of course, the same way I check for
> missing signed-off-bys.  All I would need is the list of deprecated
> things.
> 

We could just use a simple script.  It wouldn't add build warnings to
the normal build and it could also work for macros.


diff --git a/scripts/check_deprecated.pl b/scripts/check_deprecated.pl
new file mode 100755
index 000000000000..4f5571d0bfde
--- /dev/null
+++ b/scripts/check_deprecated.pl
@@ -0,0 +1,34 @@
+#!/usr/bin/perl
+
+use strict;
+
+open(LIST, "<", "scripts/deprecated_stuff");
+
+my %warnings;
+my $regex = "(";
+my $first = 1;
+while (<LIST>) {
+    if ($_ =~ /(\w+) (.*)/) {
+        if ($first) {
+            $regex = "$regex$1";
+            $first = 0;
+        } else {
+            $regex = "$regex|$1";
+        }
+
+        $warnings{$1} = $2;
+    }
+}
+$regex = "$regex)";
+
+close(LIST);
+
+while (<>) {
+    if (!($_ =~ /^\+/)) {
+        next;
+    }
+
+    if ($_ =~ /\b($regex)\b/) {
+        print $warnings{$1} . "\n";
+    }
+}
diff --git a/scripts/deprecated_stuff b/scripts/deprecated_stuff
new file mode 100644
index 000000000000..01623103aece
--- /dev/null
+++ b/scripts/deprecated_stuff
@@ -0,0 +1,2 @@
+strcpy strcpy is insecure
+blah some reason
-- 
2.11.0



More information about the Ksummit-discuss mailing list