Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp699443ybe; Thu, 5 Sep 2019 04:41:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqzIYTELN1QkWy4kOVYKjkBqLkNgC1ydN+ND6/shzGrdBnma1QIeC1PzkX+MOk7Vyw3XECyH X-Received: by 2002:aa7:9591:: with SMTP id z17mr3232034pfj.215.1567683704936; Thu, 05 Sep 2019 04:41:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567683704; cv=none; d=google.com; s=arc-20160816; b=Kzf2Fvb36D67HBpfx4oszr6MYFxVylGuUa46/E1rTuH+tpEkDIS1UyZmoSQRdeT720 xVxR6tMPoI9LykwX6z4BRF/bfmrmcNjdwbe4WTbJcl0SagF758Kph6KrUlqQGfNfwPUM OV6VE9Q7/dwD95OFQuWsJSUwpW63hRqgJjQf/hSru6ko2jR6/afIHW48E38DTpnn4Pi6 GtO1SEBN6H5zBjPuNJCDpAFFOHrwzLrpy1ssUBHtK+fP+AcJkO2008egYOspEupF+j8O RTU4Jp+impIsoRs3T27uMaBk4DxfPzi+hhuCAE+OjNQGs0NJZWSdoXMcNKKEdIGbOdPT lQ6A== 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=GwAXWaIG70/WbDUF++HFpZVikvp7aasZMPX5jgxmo1WN9EEUrbgOj1D9EQBq3Hg5/1 FpLO9o9zIX8EaTeMfeToekUwIDar+E4AvOt3ohEBV9QQ6UigSZWEmk2Vcv7W/OGrdjjR XS6j5+QGSBIT0syOSB/0xR9YqR4hVPTUegxEmIsn5VmqLNkbcOFrKFBWwK7/xBPlAf4M HlnHCWCllQpZqm3wrCXxIpZY55HtmkDkIUZrS0DsWQcBEOOxiX6D0TzPTyKeQkp3CXcA J2mbTeVucgHOJhQ5t3hTptGd26yUXJ2p3DiDe0Dw/oj31pKn83DyZPfuhtB7GtQuX0Xc IvsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=hY0wRutm; 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 e4si1820855pln.193.2019.09.05.04.41.29; Thu, 05 Sep 2019 04:41:44 -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=hY0wRutm; 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 S1733270AbfIEJXV (ORCPT + 99 others); Thu, 5 Sep 2019 05:23:21 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:39726 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725290AbfIEJXU (ORCPT ); Thu, 5 Sep 2019 05:23:20 -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=hY0wRutmWAyrVgIclY0UBKDXKG kDGfkFIQYuNG822t5f4eBDptsd3awjVjgfBUMMtc02l+fOdNCuTVIWWVV2uklrEtK/e2TlLg01r/O QwrRFsHTdIJhsLEQeSuqvuSBdDy+Zx8+HsyQ2SIuAJmMfN03jYXny65bTTmpaexB2qVMIgq5wiAoi OdhRu90dli4j8eJ4wOkp/tdNO3ePvNebZxzbx6hp5wFvuqvWLXy8uYegazKRo2K7Y2cejO1E31QF2 tGQ1U7XVnHgT5p0ldleCzasXAcfSTWzBRuTuNILnVgy7vfDdnrBQX88X2Bf+FXzNpaD2mpVVFd2rJ V2cs1JPg==; Received: from 177.17.137.173.dynamic.adsl.gvt.net.br ([177.17.137.173] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1i5nz5-0005Be-W1; Thu, 05 Sep 2019 09:23:20 +0000 Received: from mchehab by bombadil.infradead.org with local (Exim 4.92.1) (envelope-from ) id 1i5nz3-0006tA-Kn; Thu, 05 Sep 2019 06:23:17 -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 , Jessica Yu , Federico Vaga , Thomas Gleixner , linux-doc@vger.kernel.org Subject: [PATCH] docs: license-rules.txt: cover SPDX headers on Python scripts Date: Thu, 5 Sep 2019 06:23:13 -0300 Message-Id: <88e638eb959095ab6657d295f9f8c27169569bf2.1567675272.git.mchehab+samsung@kernel.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190905055614.7958918b@coco.lan> References: <20190905055614.7958918b@coco.lan> 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