From patchwork Mon Aug 28 11:39:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Kerr X-Patchwork-Id: 806542 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xgqZ46KWcz9sD9 for ; Mon, 28 Aug 2017 21:39:56 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="IHB8oBTH"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3xgqZ44sKFzDqBb for ; Mon, 28 Aug 2017 21:39:56 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="IHB8oBTH"; dkim-atps=neutral X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Received: from ozlabs.org (ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3xgqYw5W1CzDq75 for ; Mon, 28 Aug 2017 21:39:48 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="IHB8oBTH"; dkim-atps=neutral Received: by ozlabs.org (Postfix, from userid 1023) id 3xgqYw4T5zz9sN7; Mon, 28 Aug 2017 21:39:48 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1503920388; bh=Xn09vg/bE6dJgFMOR2n5EuVDfCeLiLxeRaZSLD6qFr0=; h=From:To:Subject:Date:From; b=IHB8oBTH/9elNaMz3r3S6JzNpNPKFCGbPkbbqQI7f4+vnlNDvmnNv0qXChoHmuXUZ UHbqrtZB0w3bmwC6p80CfuvY07mSZZ9fZJm8Nh4wcfCwDzLNoy4v7kVf3XDwstd6Ye 4mT8x5PcVXXxB+DWHwK7ePcbFOUm7QplnnbVLguTRKIDSSe7QlE21dgwP6WoNv4ZHO WE4vtbzKM60nXL6F0qqZAr36+h8gxTJxAUtX0nsz02C92pKMLKwAKqzBIw3BTuvcHB ejJEvsZlTeLn6Ih5IXv5XzkB4/VrSnHmmLubNTrLEPRPzBrJbefbzQZxifFLIHNo2i PSIL2EbmoWg7Q== From: Jeremy Kerr To: patchwork@lists.ozlabs.org Subject: [PATCH 1/2] tests: Run FuzzTest within a transaction Date: Mon, 28 Aug 2017 19:39:17 +0800 Message-Id: <1503920358-26652-1-git-send-email-jk@ozlabs.org> X-Mailer: git-send-email 2.7.4 X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" Currently, the FuzzTests fail for me with: /backends/base/base.py", line 428, in validate_no_broken_transaction "An error occurred in the current transaction. You can't " TransactionManagementError: An error occurred in the current transaction. You can't execute queries until the end of the 'atomic' block. - because the SQL inserts can fail, during an active transaction (the first failure I see is attempting to insert \0 chars in codec-null.mbox); this causes the setup for the next test case to fail. Instead, run each test in its own transaction. Signed-off-by: Jeremy Kerr Reviewed-by: Stephen Finucane --- patchwork/tests/test_parser.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/patchwork/tests/test_parser.py b/patchwork/tests/test_parser.py index 583dfcc..9389f28 100644 --- a/patchwork/tests/test_parser.py +++ b/patchwork/tests/test_parser.py @@ -25,7 +25,7 @@ from email.utils import make_msgid import os import unittest -from django.test import TestCase +from django.test import TestCase, TransactionTestCase from django.utils import six from patchwork.models import Comment @@ -865,7 +865,7 @@ class SubjectTest(TestCase): self.assertEqual(parse_version('Hello, world (V6)', []), 6) -class FuzzTest(TestCase): +class FuzzTest(TransactionTestCase): """Test fuzzed patches.""" def setUp(self): create_project(listid='patchwork.ozlabs.org') From patchwork Mon Aug 28 11:39:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Kerr X-Patchwork-Id: 806543 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xgqZM51tlz9sD9 for ; Mon, 28 Aug 2017 21:40:11 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="DoNvx7Xa"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3xgqZM3qzdzDqBd for ; Mon, 28 Aug 2017 21:40:11 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="DoNvx7Xa"; dkim-atps=neutral X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [103.22.144.67]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3xgqYw5ykKzDq77 for ; Mon, 28 Aug 2017 21:39:48 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="DoNvx7Xa"; dkim-atps=neutral Received: by ozlabs.org (Postfix, from userid 1023) id 3xgqYw5454z9sD9; Mon, 28 Aug 2017 21:39:48 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1503920388; bh=q07SyA5h5ynF4e731xl14ImbB9jPxjskqMBLAfPwk1o=; h=From:To:Subject:Date:In-Reply-To:References:From; b=DoNvx7Xae51tmIkRORh0GxQFmQNsUwBzwtHLXXn44wMKd+pv+zA3xpvKD+kGi0AqZ Sfwepsx/ksh9lyua1tYkuAZVNCbsNILk2sid5K2ucXR0A6yOIJO52YqIrLRWaXZF81 Q3kETppcn7TXVyu5qAreu1zDR1rTpoYFtf7usbvejjTGQdAIAhmt7TzMVca4JECDAH KYQBIR+cLfioXiOmGXCcJuXD3SQcgwXkPwKuoS9LijDVjczSSID6pV2KDIPSvdhkYm j0cJsSZ2Sr7eryuEefKe3/VkqvYwufvuA2/8/BJYAGMqTh+DVlXojTM414/d80rP2V H94J2iwFcM60Q== From: Jeremy Kerr To: patchwork@lists.ozlabs.org Subject: [PATCH 2/2] lib/sql: fix permissions for v2.0.0 on postgres Date: Mon, 28 Aug 2017 19:39:18 +0800 Message-Id: <1503920358-26652-2-git-send-email-jk@ozlabs.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1503920358-26652-1-git-send-email-jk@ozlabs.org> References: <1503920358-26652-1-git-send-email-jk@ozlabs.org> X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" Some tables are no longer present, and others that are used by the web interface and mail parser need access permissions added. This change was required to get patchwork going on patchwork.ozlabs.org; there may be other permissions required, that we haven't hit yet. So, some review would be good here. Also: it's unlikely that we need DELETE for the mail parser, but I'm not confident enough to remove that at the moment. Signed-off-by: Jeremy Kerr Reviewed-by: Stephen Finucane --- lib/sql/grant-all.postgres.sql | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/sql/grant-all.postgres.sql b/lib/sql/grant-all.postgres.sql index 405ba44..c709866 100644 --- a/lib/sql/grant-all.postgres.sql +++ b/lib/sql/grant-all.postgres.sql @@ -12,6 +12,7 @@ GRANT SELECT, UPDATE, INSERT, DELETE ON auth_group, auth_user_user_permissions, auth_permission, + authtoken_token, patchwork_emailconfirmation, patchwork_state, patchwork_comment, @@ -47,9 +48,7 @@ GRANT SELECT, UPDATE ON patchwork_bundle_id_seq, patchwork_bundlepatch_id_seq, patchwork_comment_id_seq, - patchwork_submission_id_seq, patchwork_patch_id_seq, - patchwork_coverletter_id_seq, patchwork_series_id_seq, patchwork_seriespatch_id_seq, patchwork_seriesreference_id_seq, @@ -69,16 +68,17 @@ TO "www-data"; -- cover letters) and series GRANT INSERT, SELECT ON patchwork_submission, - patchwork_patch, patchwork_coverletter, - patchwork_series, patchwork_seriespatch, patchwork_seriesreference, patchwork_comment, - patchwork_person + patchwork_event TO "nobody"; GRANT INSERT, SELECT, UPDATE, DELETE ON - patchwork_patchtag + patchwork_patchtag, + patchwork_patch, + patchwork_series, + patchwork_person TO "nobody"; GRANT SELECT ON patchwork_project, @@ -87,15 +87,14 @@ GRANT SELECT ON patchwork_delegationrule TO "nobody"; GRANT UPDATE, SELECT ON - patchwork_submission_id_seq, patchwork_patch_id_seq, - patchwork_coverletter_id_seq, patchwork_series_id_seq, patchwork_seriespatch_id_seq, patchwork_seriesreference_id_seq, patchwork_person_id_seq, patchwork_comment_id_seq, - patchwork_patchtag_id_seq + patchwork_patchtag_id_seq, + patchwork_event_id_seq TO "nobody"; COMMIT;