From patchwork Mon Jan 24 11:28:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Martin_Li=C5=A1ka?= X-Patchwork-Id: 50387 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B6E6C385843D for ; Mon, 24 Jan 2022 11:29:11 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id B21093858D3C for ; Mon, 24 Jan 2022 11:28:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B21093858D3C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.cz Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 887E91F38F; Mon, 24 Jan 2022 11:28:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1643023733; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=chaNzNo0dvQv8ZBqiG8LWliNq1Y2Y77GqZLLU+g6wIo=; b=Y0tM0OfiWYp7Cxh75sd/LNnuMLRf5dKJaG/FFa+piuYnnUrfXV5gFoy07wPgmHFPyb93Sn Ozh0GMFPbsK+LWp0MRmWFVJ2ddLp8LCnMDxX/6FHaPZZrSF2geGxb+ahRujNh+jqv7kYPc qoDL6JhgrUN9ttP8T+h5IazCEkPfHO4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1643023733; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=chaNzNo0dvQv8ZBqiG8LWliNq1Y2Y77GqZLLU+g6wIo=; b=EwFB1Nl9yoqdrZs2CaAUCFyyrDNTip5AKYqmY680QgK0FApWc2D1cv4oeADgUgjplj7+wq AOhO0DuNV19iL2Aw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 7190213B5C; Mon, 24 Jan 2022 11:28:53 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id WoeRGnWN7mHaDgAAMHmgww (envelope-from ); Mon, 24 Jan 2022 11:28:53 +0000 Message-ID: <3c8f47b2-2d58-e201-5a28-8bf5cffe956a@suse.cz> Date: Mon, 24 Jan 2022 12:28:53 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 From: =?utf-8?q?Martin_Li=C5=A1ka?= Subject: [PATCH] gcc-changelog: Catch forbidden files. To: gcc-patches@gcc.gnu.org Content-Language: en-US X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jakub Jelinek Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Hi. The patch is about FORBIDDEN_FILES that we don't want to be commited. So far we have $root/Makefile.am and $root/build.log. Do you have any other candidates? Cheers, Martin contrib/ChangeLog: * gcc-changelog/git_commit.py: Add FORBIDDEN_FILES. * gcc-changelog/test_email.py: Test it. * gcc-changelog/test_patches.txt: Add test for it. --- contrib/gcc-changelog/git_commit.py | 10 ++++++++++ contrib/gcc-changelog/test_email.py | 4 ++++ contrib/gcc-changelog/test_patches.txt | 21 +++++++++++++++++++++ 3 files changed, 35 insertions(+) diff --git a/contrib/gcc-changelog/git_commit.py b/contrib/gcc-changelog/git_commit.py index 27a1d59b211..d7aec93f44b 100755 --- a/contrib/gcc-changelog/git_commit.py +++ b/contrib/gcc-changelog/git_commit.py @@ -153,6 +153,11 @@ misc_files = { 'gcc/DEV-PHASE' } +FORBIDDEN_FILES = { + 'Makefile.am', + 'build.log' +} + author_line_regex = \ re.compile(r'^(?P\d{4}-\d{2}-\d{2})\ {2}(?P.* <.*>)') additional_author_regex = re.compile(r'^\t(?P\ *)?(?P.* <.*>)') @@ -339,6 +344,11 @@ class GitCommit: self.errors.append(Error('invalid PR component in subject', info.lines[0])) self.subject_prs.add(m.group('pr')) + for f in self.info.modified_files: + if f[1] != 'D': + if f[0] in FORBIDDEN_FILES: + self.errors.append(Error('forbidden file name', f[0])) + # Allow complete deletion of ChangeLog files in a commit project_files = [f for f in self.info.modified_files if (self.is_changelog_filename(f[0], allow_suffix=True) and f[1] != 'D') diff --git a/contrib/gcc-changelog/test_email.py b/contrib/gcc-changelog/test_email.py index a4796dbbe94..28ad6552a93 100755 --- a/contrib/gcc-changelog/test_email.py +++ b/contrib/gcc-changelog/test_email.py @@ -446,3 +446,7 @@ class TestGccChangelog(unittest.TestCase): email = self.from_patch_glob('non-ascii-email.patch') assert (email.errors[0].message == 'non-ASCII characters in git commit email address (jbglaw@ług-owl.de)') + + def test_forbidden_file(self): + email = self.from_patch_glob('Makefile.am.patch') + assert (email.errors[0].message == 'forbidden file name') diff --git a/contrib/gcc-changelog/test_patches.txt b/contrib/gcc-changelog/test_patches.txt index 98a0d3f1ee0..b59afe16bd3 100644 --- a/contrib/gcc-changelog/test_patches.txt +++ b/contrib/gcc-changelog/test_patches.txt @@ -3489,3 +3489,24 @@ index 2a9917cde62..0033b0004b3 100644 @@ -0,0 +1,1 @@ + -- + +=== Makefile.am.patch === +From 80c9d63af350b280bfccb82adb3867c25a25e6d0 Mon Sep 17 00:00:00 2001 +From: Martin Liska +Date: Mon, 24 Jan 2022 12:17:09 +0100 +Subject: [PATCH] Add Makefile.am file. + +--- + Makefile.am | 0 + 1 file changed, 0 insertions(+), 0 deletions(-) + create mode 100644 Makefile.am + +diff --git a/Makefile.am b/Makefile.am +new file mode 100644 +index 00000000000..d6459e00543 +--- /dev/null ++++ b/Makefile.am +@@ -0,0 +1 @@ ++xxx +-- +2.34.1