Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1464643ybe; Thu, 5 Sep 2019 16:09:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqwjuRtpS+EMStn/+K0o66n1YR6WpBjaxn3eF+h+5ivX0k63DcRGczTCGukw7zVRylEG9k3v X-Received: by 2002:a17:902:aa4a:: with SMTP id c10mr6017723plr.340.1567724999701; Thu, 05 Sep 2019 16:09:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567724999; cv=none; d=google.com; s=arc-20160816; b=lYgkLctaAROjnxFBmKymZ3Wtr0v8gDNYp+fteXtWPjgMqkQmrZeZUrljT3rbbxKTEg r0Fjo+rg7wvbwuZc67MT4GbbNbkefIUx7BLxCeHb/4xVYyBJU+9WYTKgT156RAMzcV4E dq2+ZsIyqy8B2HEWlmCw7bE4b9SJp+kqfcMEnMM54QdxsI6Obz6uXi83hGPJqGiQ8iSC +pEDEN16HN+WWANL8rOOj96dBryx01XstD60dlTgSjLfLbHBPs6+jwCxZeTktqPjXO4B X6ZuWv0WUXaS6d4ZAlgSBq1rvfwn+sNSCuxfWRJ5W7wnyyS7W8VCrvA7ojwCAWwzFPst UJsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Nq0/AIfadmx52mPl01oTaYnDgOBbCeLTbcoEAfHL7Zg=; b=nPjgMqcQ9dCpFb2VlmhO1/71afbKVXyjvt0lMw+17+QTmIn14YD75lzg2CFPUMJToE NZiChgpDVNiVlpHYzUl5Hc76O0H8fq4y/3XZDwHTBiOhtQ7b5+hxK6MHNcpwe8eWbSPe AcJ5CsAJCtYAoemhmMDovWtg7c/xWRrczkqhF8gJa3US32+N4UlUUXEI1+n//UBRln5O Y0NzBiLA0qEqy8kGWTk3/mQATUMmXmlZm8U6yul8S02+rfn9SYdlfgurwQV0uCu1lWbL QEz6tzrWpSQFP58i2pLfp9FJuH9QfAYozFWGD76gOCr3mUCQFJ80teUh7upQhYtw2L7K 18/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=P0VyW60v; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q3si3176684pgs.576.2019.09.05.16.09.42; Thu, 05 Sep 2019 16:09:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=P0VyW60v; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391581AbfIET56 (ORCPT + 99 others); Thu, 5 Sep 2019 15:57:58 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:58444 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728262AbfIET56 (ORCPT ); Thu, 5 Sep 2019 15:57:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Nq0/AIfadmx52mPl01oTaYnDgOBbCeLTbcoEAfHL7Zg=; b=P0VyW60vKrlgkIq79p4R03w8gf D9QfNlomgkxG2Cr+83PxymCjoetMrZOfaLhcUyW7gwmZefv1Ep6tAmRUzXmsYX2F9cSCzf6VY3fa3 zhLtjFyF1TV5QbXZUMSTpXITid8E/0DsIqVSjo4MJC/fz9tYcTKtGcjczfU2Z32CNM2eK1SVHpctY Lu61SKIZ1QQhvQ8jez38uUTtGXrbEDtIHEo0+Djys6D1s4xt6jLWkTHZvLpQpSNIallR0jn8G85uu yrUUdk1VDRPBrdieFq0IRYIwQZWTkALicLLVAcDcdrQnpKs2Y+5LhorQtAwFAopOPMIS6KH4cQyVm YKtTA2eg==; Received: from [177.159.253.249] (helo=bombadil.infradead.org) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1i5xtF-0000IC-B2; Thu, 05 Sep 2019 19:57:57 +0000 Received: from mchehab by bombadil.infradead.org with local (Exim 4.92.1) (envelope-from ) id 1i5xtC-0005mG-NY; Thu, 05 Sep 2019 16:57:54 -0300 From: Mauro Carvalho Chehab To: Linux Media Mailing List Cc: Mauro Carvalho Chehab , Mauro Carvalho Chehab , Greg Kroah-Hartman , Joe Perches , linux-kernel@vger.kernel.org, Jonathan Corbet , Federico Vaga , Thomas Gleixner , linux-doc@vger.kernel.org Subject: [PATCH 4/6] docs: license-rules.txt: cover SPDX headers on Python scripts Date: Thu, 5 Sep 2019 16:57:51 -0300 Message-Id: <9dfa708fea2f9df22fa9df60dff0b3152241af8d.1567712829.git.mchehab+samsung@kernel.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The author of the license-rules.rst file wanted to be very restrict with regards to the location of the SPDX header. It says that the SPDX header "shall be added at the first possible line in a file which can contain a comment". Not happy with this already restrictive requiement, it goes further: "For the majority of files this is the first line, except for scripts", opening an exception to have the SPDX header at the second line, if the first line starts with "#!". Well, it turns that this is too restrictive for Python scripts, and may cause regressions if this would be enforced. As mentioned on: https://stackoverflow.com/questions/728891/correct-way-to-define-python-source-code-encoding Python's PEP-263 [1] dictates that an script that needs to default to UTF-8 encoding has to follow this rule: 'Python will default to ASCII as standard encoding if no other encoding hints are given. To define a source code encoding, a magic comment must be placed into the source files either as first or second line in the file' And: 'More precisely, the first or second line must match the following regular expression: ^[ \t\f]*#.*?coding[:=][ \t]*([-_.a-zA-Z0-9]+)' [1] https://www.python.org/dev/peps/pep-0263/ If a script has both "#!" and the charset encoding line, we can't place a SPDX tag without either violating license-rules.rst or breaking the script by making it crash with non-ASCII characters. So, add a sort notice saying that, for Python scripts, the SPDX header may be up to the third line, in order to cover the case where both "#!" and "# .*coding.*UTF-8" lines are found. Signed-off-by: Mauro Carvalho Chehab --- Documentation/process/license-rules.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Documentation/process/license-rules.rst b/Documentation/process/license-rules.rst index 2ef44ada3f11..5d23e3498b1c 100644 --- a/Documentation/process/license-rules.rst +++ b/Documentation/process/license-rules.rst @@ -64,9 +64,12 @@ License identifier syntax possible line in a file which can contain a comment. For the majority of files this is the first line, except for scripts which require the '#!PATH_TO_INTERPRETER' in the first line. For those scripts the SPDX - identifier goes into the second line. + identifier goes into the second line\ [1]_. -| +.. [1] Please notice that Python scripts may also need an encoding rule + as defined on PEP-263, which should be defined either at the first + or the second line. So, for such scripts, the SPDX identifier may + go up to the third line. 2. Style: -- 2.21.0