From patchwork Thu Sep 15 14:39:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Lautrbach X-Patchwork-Id: 9333825 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2B4C96089F for ; Thu, 15 Sep 2016 14:42:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1F99B298C1 for ; Thu, 15 Sep 2016 14:42:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1409E298CA; Thu, 15 Sep 2016 14:42:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00 autolearn=ham version=3.3.1 Received: from emsm-gh1-uea10.nsa.gov (smtp.nsa.gov [8.44.101.8]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8FA43298C3 for ; Thu, 15 Sep 2016 14:42:33 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.30,339,1470700800"; d="scan'208";a="17619046" IronPort-PHdr: =?us-ascii?q?9a23=3AMnIbVxPL0ouKdgf+dY0l6mtUPXoX/o7sNwtQ0KIM?= =?us-ascii?q?zox0KPv5rarrMEGX3/hxlliBBdydsKMdzbWL+P+8ESxYuNDa4ShEKMQNHzY+yu?= =?us-ascii?q?wu1zQ6B8CEDUCpZNXLVAcdWPp4aVl+4nugOlJUEsutL3fbo3m18CJAUk6nbVk9?= =?us-ascii?q?GO35F8bogtit0KjqotuIMlwO22f2Pu86bE3v616A7o9O2coqA51y4yOBmmFPde?= =?us-ascii?q?VSyDEgDnOotDG42P2N+oV++T9bofMr+p0Ie6z7e6MlUe4QV2x+YCgI/smjiT3v?= =?us-ascii?q?BUvKuDpPGlkRxwFFBwnD8QHSQob6siy8sPF0niadI57YV7cxDAyv870jbBb1lD?= =?us-ascii?q?0NPjU5uDXPjsVtkLhRqTq7qhB/ypKSa4aQYqktNpjBdM8XEDISFv1aUDZMV8bi?= =?us-ascii?q?Yg=3D=3D?= X-IPAS-Result: =?us-ascii?q?A2FbCADZstpX/wHyM5BcHAEBBAEBCgEBGAEFAQsBgw8BAQE?= =?us-ascii?q?BAR5XfLpUIw2BboVnTAEBAQEBAQEBAgECWyeCMgQDEwUFOTsBAQEBAQEBIwINI?= =?us-ascii?q?j0CBAECNxQgDgMJAQEXKQgIAwEtFREOCwUYBIgpDsFpCwEBASOGMYhhEQFohRA?= =?us-ascii?q?Fji6LOoYliTQCgWyIDAyFX5BZVIRpbgGEYXiBJwEBAQ?= Received: from unknown (HELO tarius.tycho.ncsc.mil) ([144.51.242.1]) by emsm-gh1-uea10.nsa.gov with ESMTP; 15 Sep 2016 14:42:18 +0000 Received: from prometheus.infosec.tycho.ncsc.mil (prometheus [192.168.25.40]) by tarius.tycho.ncsc.mil (8.14.4/8.14.4) with ESMTP id u8FEgHW2022548; Thu, 15 Sep 2016 10:42:17 -0400 Received: from tarius.tycho.ncsc.mil (tarius.infosec.tycho.ncsc.mil [144.51.242.1]) by prometheus.infosec.tycho.ncsc.mil (8.15.2/8.15.2) with ESMTP id u8FEdupE251123 for ; Thu, 15 Sep 2016 10:39:56 -0400 Received: from goalie.tycho.ncsc.mil (goalie [144.51.242.250]) by tarius.tycho.ncsc.mil (8.14.4/8.14.4) with ESMTP id u8FEdqKE022025 for ; Thu, 15 Sep 2016 10:39:56 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A1DMAAD1sdpXhxy3hNFcHAEFAQsBgzsBAQEBAXV8pROROYQSJoV4AoFbTAECAQEBAQECEwEBAQoLCQkZhRECAQN5EFFXGYhKDsFoAQEIAiWGMYlbhRAFji6LOoYliTQCgWyIGIVfkFmDYoFbOjQBhwABAQE X-IPAS-Result: A1DMAAD1sdpXhxy3hNFcHAEFAQsBgzsBAQEBAXV8pROROYQSJoV4AoFbTAECAQEBAQECEwEBAQoLCQkZhRECAQN5EFFXGYhKDsFoAQEIAiWGMYlbhRAFji6LOoYliTQCgWyIGIVfkFmDYoFbOjQBhwABAQE X-IronPort-AV: E=Sophos;i="5.30,339,1470715200"; d="scan'208";a="5707728" Received: from emsm-gh1-uea10.corp.nsa.gov (HELO emsm-gh1-uea10.nsa.gov) ([10.208.41.36]) by goalie.tycho.ncsc.mil with ESMTP; 15 Sep 2016 10:39:56 -0400 IronPort-PHdr: =?us-ascii?q?9a23=3Ag9U8uxTEWMWRmlv3kQEHMd+Xstpsv+yvbD5Q0YIu?= =?us-ascii?q?jvd0So/mwa64YR2N2/xhgRfzUJnB7Loc0qyN4vmmBjFLvsrJ8ChbNscdD1ld0Y?= =?us-ascii?q?RetjdjKfbNMVf8Iv/uYn5yN+V5f3ghwUuGN1NIEt31fVzYry76xzcTHhLiKVg9?= =?us-ascii?q?fbytScbshsi6n9q/54fUK10RwmHsOPUtcV7p8U2R7pBQ2to6bP5pi1PgmThhQ6?= =?us-ascii?q?xu32RmJFaezV7Xx/yb29pdyRlWoO8r7MVaUK/3LOwSRL1cCyk6YShuvJW4/UqL?= =?us-ascii?q?cQza/XYYU2MLgjJUEgPF61f8RZ63vSzk5cRn3yzPBcDqV/gQUCm+9a1iQx+g3D?= =?us-ascii?q?8DPiMl6mveotZ9gKJSvFSqoBkpkN2cW52cKPcrJvCVRtgdX2cUBss=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0FVAQCksdpXhxy3hNFcHAEBBAEBCgEBG?= =?us-ascii?q?AEFAQsBgw8BAQEBAXV8pROROYQSJoFuhAoCgVtMAQEBAQEBAQECAQIQAQEBCgs?= =?us-ascii?q?JCRkvgjIYDDk7AQEBAQEBASMCDSI9AgEDeRBRVxmISg7BaQEBCAIBJIYxiVuFE?= =?us-ascii?q?AWOLos6hiWJNAKBbIgYhV+QWYNigVs6NAGHAAEBAQ?= X-IPAS-Result: =?us-ascii?q?A0FVAQCksdpXhxy3hNFcHAEBBAEBCgEBGAEFAQsBgw8BAQE?= =?us-ascii?q?BAXV8pROROYQSJoFuhAoCgVtMAQEBAQEBAQECAQIQAQEBCgsJCRkvgjIYDDk7A?= =?us-ascii?q?QEBAQEBASMCDSI9AgEDeRBRVxmISg7BaQEBCAIBJIYxiVuFEAWOLos6hiWJNAK?= =?us-ascii?q?BbIgYhV+QWYNigVs6NAGHAAEBAQ?= X-IronPort-AV: E=Sophos;i="5.30,339,1470700800"; d="scan'208";a="17618785" Received: from mx1.redhat.com ([209.132.183.28]) by emsm-gh1-uea10.nsa.gov with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Sep 2016 14:39:55 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DA0749D0DB for ; Thu, 15 Sep 2016 14:39:54 +0000 (UTC) Received: from rhel-at-redhat.localdomain.com ([10.40.2.167]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u8FEdmJK003247; Thu, 15 Sep 2016 10:39:54 -0400 From: Petr Lautrbach To: selinux@tycho.nsa.gov Subject: [PATCH 2/3] sandbox: tests - close stdout of p1 Date: Thu, 15 Sep 2016 16:39:28 +0200 Message-Id: <1473950369-2547-2-git-send-email-plautrba@redhat.com> In-Reply-To: <1473950369-2547-1-git-send-email-plautrba@redhat.com> References: <1473950369-2547-1-git-send-email-plautrba@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 15 Sep 2016 14:39:54 +0000 (UTC) X-BeenThere: selinux@tycho.nsa.gov X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Security-Enhanced Linux \(SELinux\) mailing list" List-Post: List-Help: MIME-Version: 1.0 Errors-To: selinux-bounces@tycho.nsa.gov Sender: "Selinux" X-Virus-Scanned: ClamAV using ClamSMTP p1.stdout should be closed after it's connected to p2 according to https://docs.python.org/3/library/subprocess.html#replacing-shell-pipeline Fixes: $ make PYTHON=python3 test Verify that we can read file descriptors handed to sandbox ... /usr/lib64/python3.5/unittest/case.py:638: ResourceWarning: unclosed file <_io.BufferedReader name=4> testMethod() Signed-off-by: Petr Lautrbach --- policycoreutils/sandbox/test_sandbox.py | 1 + 1 file changed, 1 insertion(+) diff --git a/policycoreutils/sandbox/test_sandbox.py b/policycoreutils/sandbox/test_sandbox.py index d5368c2..98c04a7 100644 --- a/policycoreutils/sandbox/test_sandbox.py +++ b/policycoreutils/sandbox/test_sandbox.py @@ -28,6 +28,7 @@ class SandboxTests(unittest.TestCase): "Verify that we can read file descriptors handed to sandbox" p1 = Popen(['cat', '/etc/passwd'], stdout=PIPE) p2 = Popen([sys.executable, 'sandbox', 'grep', 'root'], stdin=p1.stdout, stdout=PIPE) + p1.stdout.close() out, err = p2.communicate() self.assertTrue(b'root' in out)