From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id KmvnDbQ7kGW+gy4AWB0awg (envelope-from ) for ; Sat, 30 Dec 2023 10:48:04 -0500 Authentication-Results: simark.ca; dkim=pass (2048-bit key; secure) header.d=lancelotsix.com header.i=@lancelotsix.com header.a=rsa-sha256 header.s=2021 header.b=zOaEkOmE; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 2619F1E0C3; Sat, 30 Dec 2023 10:48:04 -0500 (EST) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 9E1BC1E0B9 for ; Sat, 30 Dec 2023 10:48:01 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BC330385841F for ; Sat, 30 Dec 2023 15:48:00 +0000 (GMT) Received: from lndn.lancelotsix.com (lndn.lancelotsix.com [51.195.220.111]) by sourceware.org (Postfix) with ESMTPS id C83F53858CDB for ; Sat, 30 Dec 2023 15:47:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C83F53858CDB Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=lancelotsix.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=lancelotsix.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C83F53858CDB Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=51.195.220.111 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703951264; cv=none; b=EYXclVn8kjxFihTuUAJqMbWjAH5xlO8rn/zWOlOHizQQOC6zUPe8wnT4kkzDzowCWXeksa3Uzd1qYloGnXdblrC7HU5jDkB2JLRq4RZnRHgH+7H6qW+E1cYgF5P7BdwAuRm+t4afpPZ8FCEz9v3e/mRzsDdVcSdj+NP3gowwcCo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703951264; c=relaxed/simple; bh=czFcrxHA+KqyUNpcACHEkySfw1KWs4dzf7b9Cp3dPec=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=CA088TlOcOoskBewCAMc85jSi0zb506sq2/02LpEXK9BE8Q8YJZSBu6Xxsc+fZDx2PLYpR93YTqcMDKm3YcB1eOOjtbgBE/HL+mXjOa7YihN+7+iM60iuVNSp0pEwk5mN/dNP4IyxTqjTiJQc8/mdAEug/IPf3CS1XMyeruIakI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from octopus (cust120-dsl54.idnet.net [212.69.54.120]) by lndn.lancelotsix.com (Postfix) with ESMTPSA id 534E78115E; Sat, 30 Dec 2023 15:47:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lancelotsix.com; s=2021; t=1703951261; bh=czFcrxHA+KqyUNpcACHEkySfw1KWs4dzf7b9Cp3dPec=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=zOaEkOmE+MDiYsgGhphs60ErCbwWETrT0ED6I6yxJOWcceGamo1BQGD5ItO1CObS/ q+DxvxyXdFjdFBsPCAr4Le+9v6zE3xPPzlurv2g/iqcVV8UDN0oyo0tBPFmVkN3Egb 1kzCvb3yBIIIDSrTpXLMq0KcR5YrOfPy4BcpXzJ+PZ/o4ib4wKalMtOTs8m0tukpMv ZZumiT8DWkB3aQUivX2IAAbUcuFPd1spg4CrLAK18L4p8CXBNtk28IS61AZa8B/diL /EV2C759C9MVl0FzMtzWPo4UroOKJN3PExWjCGMdzVedCH13C/fYnEFuv1sfsFHE5G zKpIE2+PM9Q2Q== Date: Sat, 30 Dec 2023 15:47:32 +0000 From: Lancelot SIX To: Tom de Vries Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] [gdb/testsuite] Fix gdb.base/gdb-index-err.exp for root user Message-ID: <20231230154721.phc7hqhxmn7fkt5i@octopus> References: <20231229063543.10033-1-tdevries@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20231229063543.10033-1-tdevries@suse.de> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.2 (lndn.lancelotsix.com [0.0.0.0]); Sat, 30 Dec 2023 15:47:41 +0000 (UTC) X-Spam-Status: No, score=-12.0 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, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Hi Tom, On Fri, Dec 29, 2023 at 07:35:43AM +0100, Tom de Vries wrote: > When running test-case gdb.base/gdb-index-err.exp in a container as root user, > I run into: > ... > FAIL: gdb.base/gdb-index-err.exp: flag=: \ > try to write index to a non-writable directory > FAIL: gdb.base/gdb-index-err.exp: flag=-dwarf-5: \ > try to write index to a non-writable directory > ... > > The test-case creates a directory without write permissions: > ... > $ ls -ald private > dr-xr-xr-x 2 root root 4096 Dec 29 06:26 private/ > ... > but apparently the root user is still able to write in it. > > Fix this by making the test unsupported for the root user. > > Tested on x86_64-linux. > > PR testsuite/31197 > Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31197 > --- > gdb/testsuite/gdb.base/gdb-index-err.exp | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/gdb/testsuite/gdb.base/gdb-index-err.exp b/gdb/testsuite/gdb.base/gdb-index-err.exp > index 31f133efbcd..cefd708f5ab 100644 > --- a/gdb/testsuite/gdb.base/gdb-index-err.exp > +++ b/gdb/testsuite/gdb.base/gdb-index-err.exp > @@ -62,9 +62,15 @@ remote_exec host "chmod u-w,g-w ${non_writable_dir}" > > # Try to write the index into a non-writable directory. > foreach_with_prefix flag { "" "-dwarf-5" } { > + set test "try to write index to a non-writable directory" > + if { [root_user] } { > + unsupported $test > + continue > + } > + > gdb_test "save gdb-index ${flag} ${non_writable_dir}" \ > "Error while writing index for `[string_to_regexp $binfile]': couldn't open `[string_to_regexp $non_writable_dir]/${gdb_test_file_name}.*': Permission denied\\." \ > - "try to write index to a non-writable directory" > + $test > } > > # Create copies of the executable, we will add an index section to > > base-commit: a6d0019eb7fcd634e12b7bcc535d5181c47fc82a > -- > 2.35.3 > This looks reasonable to me. Thanks for doing this. I had a look around because the other places which use root_user generate XFAILs and not UNSUPPORTED as you do here. I however don’t think that gdb.base/fileio.exp could use UNSUPPORTED, and it is better suited for the case you are addressing here, so that LGTM. Best, Lancelot. Reviewed-By: Lancelot SIX