From patchwork Fri Dec 29 06:35:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 82977 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 CECB23858C52 for ; Fri, 29 Dec 2023 06:36:09 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2a07:de40:b251:101:10:150:64:2]) by sourceware.org (Postfix) with ESMTPS id 6899D3858D28 for ; Fri, 29 Dec 2023 06:35:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6899D3858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6899D3858D28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:2 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703831744; cv=none; b=rlArXaN4OKp/9QGiIYOZsIKorMaY8J/I7rql7+u1yoHefdDsHHIWxV0h5y9CBdRtETy8ruMeXcekKnGZouMDdVC4cUCOSwxzW7ZUsaumK6slID66A12OiEOwID7BA4wfCEdGF78m+I1AzlDFvRXpFRGGzN8Gt9gKF32V+Ju/PBk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703831744; c=relaxed/simple; bh=ytFSjOEPw3QKCyG3DiQQubIzzHmZYDC5M8mEVLfGtV4=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-Id:MIME-Version; b=qmxhNUpfK1anjyJ4+wal9QlPCzKYQjEXSntTonAnn71wIxdnKjX6xBZavMkkFoo4GjckGVDzsYMaoEP7lo6h1nQYqZuxoy3iGwoAYAlT3xzPusyMfitBsDY4p5IGxioYT8VVv1EDID1pDgXpEo1mQ1MRCbc83TfNGi8AswrrjDA= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id BD0981F793 for ; Fri, 29 Dec 2023 06:35:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1703831739; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=Hk1gVczg3wSAZcyBAtXBdx09t/cD27UzHrxUbeh4KLE=; b=ZL7Vyz8Gb0MhvoEYkwsdmfscNsnCTYXTuffW9J24KKZCyn+Rv9lVBIRRjuYeLN5E2gban7 3j6R/LvFQAW4m9Ft37mkae7cu0TlXlM9MpHMi5fSHhfSSwjKctWloyv5EARjol/a26VlRb 79B4FMcyBmQaX2Xt4U0g96g1l8W0Qys= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1703831739; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=Hk1gVczg3wSAZcyBAtXBdx09t/cD27UzHrxUbeh4KLE=; b=Vz+csRduQGxJGoDvKL2r33lulCjjl25TwxFDwJOmgR4/2DTGuz/Sp25NDppbFQZFb1V3zL FYc1xICFeMGv51Dw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1703831739; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=Hk1gVczg3wSAZcyBAtXBdx09t/cD27UzHrxUbeh4KLE=; b=ZL7Vyz8Gb0MhvoEYkwsdmfscNsnCTYXTuffW9J24KKZCyn+Rv9lVBIRRjuYeLN5E2gban7 3j6R/LvFQAW4m9Ft37mkae7cu0TlXlM9MpHMi5fSHhfSSwjKctWloyv5EARjol/a26VlRb 79B4FMcyBmQaX2Xt4U0g96g1l8W0Qys= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1703831739; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=Hk1gVczg3wSAZcyBAtXBdx09t/cD27UzHrxUbeh4KLE=; b=Vz+csRduQGxJGoDvKL2r33lulCjjl25TwxFDwJOmgR4/2DTGuz/Sp25NDppbFQZFb1V3zL FYc1xICFeMGv51Dw== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id A1D07133E5 for ; Fri, 29 Dec 2023 06:35:39 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id IzN+JbtojmVjKQAAD6G6ig (envelope-from ) for ; Fri, 29 Dec 2023 06:35:39 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH] [gdb/testsuite] Fix gdb.base/gdb-index-err.exp for root user Date: Fri, 29 Dec 2023 07:35:43 +0100 Message-Id: <20231229063543.10033-1-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 X-Spam-Score: 1.90 X-Spamd-Result: default: False [1.90 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; R_MISSING_CHARSET(2.50)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[gdb-patches@sourceware.org]; BROKEN_CONTENT_TYPE(1.50)[]; RCPT_COUNT_ONE(0.00)[1]; RCVD_COUNT_THREE(0.00)[3]; TO_DN_NONE(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; MID_CONTAINS_FROM(1.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-3.00)[100.00%] Authentication-Results: smtp-out2.suse.de; none X-Spam-Status: No, score=-12.3 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+patchwork=sourceware.org@sourceware.org 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 Reviewed-By: Lancelot SIX --- gdb/testsuite/gdb.base/gdb-index-err.exp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) base-commit: a6d0019eb7fcd634e12b7bcc535d5181c47fc82a 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