From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id CBD3415800D for ; Sat, 1 Jul 2023 23:54:20 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 1A81AE07EA; Sat, 1 Jul 2023 23:54:19 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id F3D95E07EA for ; Sat, 1 Jul 2023 23:54:18 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 09C81335D6D for ; Sat, 1 Jul 2023 23:54:18 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 8EBD2136 for ; Sat, 1 Jul 2023 23:54:16 +0000 (UTC) From: "Mike Gilbert" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Gilbert" Message-ID: <1688255581.378995f8efc182f42c4e553eacb081cd67bb2f2a.floppym@gentoo> Subject: [gentoo-commits] proj/sandbox:stable-2.x commit in: tests/ X-VCS-Repository: proj/sandbox X-VCS-Files: tests/fchmod-1.sh tests/fchown-1.sh X-VCS-Directories: tests/ X-VCS-Committer: floppym X-VCS-Committer-Name: Mike Gilbert X-VCS-Revision: 378995f8efc182f42c4e553eacb081cd67bb2f2a X-VCS-Branch: stable-2.x Date: Sat, 1 Jul 2023 23:54:16 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 6bb685c1-03a9-48b7-a123-7eaa894bf71d X-Archives-Hash: 7121dd11d1a64414a2738ab74f4fef26 commit: 378995f8efc182f42c4e553eacb081cd67bb2f2a Author: Michael Orlitzky gentoo org> AuthorDate: Sat Jul 1 20:52:34 2023 +0000 Commit: Mike Gilbert gentoo org> CommitDate: Sat Jul 1 23:53:01 2023 +0000 URL: https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=378995f8 tests: use explicit adddeny() calls in fchmod and fchown tests. When running the test suite under portage, the entire build directory will be writable because portage adds PORTAGE_TMPDIR to SANDBOX_WRITE (thanks floppym). This breaks the tests for these two wrappers, since they expect to fail when trying to write above $PWD. To avoid that, we create a new file to call fchown/fchmod on, and then explicitly deny access to it. Closes: https://bugs.gentoo.org/909445 Signed-off-by: Michael Orlitzky gentoo.org> Signed-off-by: Mike Gilbert gentoo.org> (cherry picked from commit e5032c6b89621db0475e36fb06c2905b6a9c024c) tests/fchmod-1.sh | 6 +++++- tests/fchown-1.sh | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/fchmod-1.sh b/tests/fchmod-1.sh index db404ba..140d84f 100755 --- a/tests/fchmod-1.sh +++ b/tests/fchmod-1.sh @@ -4,11 +4,15 @@ # addwrite $PWD +rm -f deny || exit 1 +touch deny || exit 1 +adddeny $PWD/deny # The sandbox doesn't log anything when it returns a junk file # descriptor? It doesn't look like we can test the contents of # sandbox.log here... instead, we just have to count on fchmod # failing, which it does if you use O_RDWR, and it *should* if you use # O_RDONLY (because that won't stop the change of permissions). -fchmod-0 $(stat --format='%#04a' ../..) ../.. && exit 1 +fchmod-0 $(stat --format='%#04a' $PWD/deny) $PWD/deny && exit 1 + exit 0 diff --git a/tests/fchown-1.sh b/tests/fchown-1.sh index 1b4a173..6c1178e 100755 --- a/tests/fchown-1.sh +++ b/tests/fchown-1.sh @@ -4,11 +4,15 @@ # addwrite $PWD +rm -f deny || exit 1 +touch deny || exit 1 +adddeny $PWD/deny # The sandbox doesn't log anything when it returns a junk file # descriptor? It doesn't look like we can test the contents of # sandbox.log here... instead, we just have to count on fchown # failing, which it does if you use O_RDWR, and it *should* if you use # O_RDONLY (because that won't stop the change of ownership). -fchown-0 ${SB_UID} ${SB_GID} ../.. && exit 1 +fchown-0 ${SB_UID} ${SB_GID} $PWD/deny && exit 1 + exit 0