From patchwork Mon May 4 13:24:22 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 134419 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id C6CCC4BAE7C2 for ; Mon, 4 May 2026 13:24:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C6CCC4BAE7C2 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=XwK4YRB4 X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id A2D344B9DB48 for ; Mon, 4 May 2026 13:24:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A2D344B9DB48 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A2D344B9DB48 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777901069; cv=none; b=TNGplDW5MX3JDRCP/gdGlbrJbMnuX6BUGBaBdhSVkIjucYXL4dyMBokGUkwF4LOGTfzJ04SwMIzBmvDxFEmganDmn/pOeaI+s1H9qZmA1klMghnmMM5EGwKG0H/iZzOrvm1wCdkTsXg20sRl+PYHUvIdhgjf+R5+CU2Pad+SGwI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777901069; c=relaxed/simple; bh=fA6EWWx0EGqxstebEd4d8gow0w+UrHywSWwwsCWRHm0=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=nHwu2hUJeYQXtTP0G7H8v769PW3GeWW1mL88DaG0sdSGzC6sI+S1qF+H5l8fWICbRVGCIAfEXBqo/b5k5Rm5y/7h19/9u93UZEJnnXhjfuqdj8nHC6bJC4Q00jiNk17v3pP7qZGYAMXXQW0PTYEqe8VQdAZuZ9mV7N88CaU04RM= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A2D344B9DB48 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1777901069; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=UJmd9roKsHxMxdWglIogCvXxZCP+kAe+2cY7qClnRZQ=; b=XwK4YRB4Lx+IAPNnsLEt3w/qUJRcaeg3crc92LjzuiHwdHlWBN5YNwO7fmqDlKCVLHMmcu d6xT9V/kY0GDGXgeFsZzPW5f73MkhuRE6YI3vIEOaUk0C7pNL2tFl/Ip8J2x1L2tFRu0cE lykeFqx8ILbsaS2wKFgO+DRysYoIWXo= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-658-h7WJlcnOPDOec_l-fUyPyg-1; Mon, 04 May 2026 09:24:27 -0400 X-MC-Unique: h7WJlcnOPDOec_l-fUyPyg-1 X-Mimecast-MFC-AGG-ID: h7WJlcnOPDOec_l-fUyPyg_1777901066 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2743D19560B4 for ; Mon, 4 May 2026 13:24:26 +0000 (UTC) Received: from fweimer-oldenburg.csb.redhat.com (unknown [10.44.48.145]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6E4863000203 for ; Mon, 4 May 2026 13:24:25 +0000 (UTC) From: Florian Weimer To: libc-alpha@sourceware.org Subject: [PATCH] support: Improve tst-support_descriptors compatibility with containers Date: Mon, 04 May 2026 15:24:22 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: hS5zkHabQ7Q5iPngWmnNSR-RTl-fvR1SYs0izsGCB80_1777901066 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-9.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, RCVD_IN_SBL_CSS, SPF_HELO_PASS, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org If /dev/null is bind-mounted, /dev and /dev/null are on different devices, so the expected failure has an additional line describe the device change. Reviewed-by: Carlos O'Donell --- support/tst-support_descriptors.c | 41 ++++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-) base-commit: ef2e5453b166b9339fd92b685c10312b423be7eb diff --git a/support/tst-support_descriptors.c b/support/tst-support_descriptors.c index 97d7284c69..d25cb7d67a 100644 --- a/support/tst-support_descriptors.c +++ b/support/tst-support_descriptors.c @@ -128,21 +128,48 @@ test_run (void) support_capture_subprocess_free (&proc); free (expected); + good = good && !support_record_failure_is_failed (); + proc = support_capture_subprocess (&subprocess_changed_descriptor, NULL); + good = good && support_record_failure_is_failed (); + support_record_failure_reset (); /* Discard the reported error. */ + report_subprocess_output ("subprocess_changed_descriptor", &proc); + expected = xasprintf ("\nDifferences:\n" "error: descriptor %d changed from \"/dev/null\"" " to \"/dev\"\n" "error: descriptor %d changed ino ", free_descriptor, free_descriptor); - good = good && !support_record_failure_is_failed (); - proc = support_capture_subprocess (&subprocess_changed_descriptor, NULL); - good = good && support_record_failure_is_failed (); - support_record_failure_reset (); /* Discard the reported error. */ - report_subprocess_output ("subprocess_changed_descriptor", &proc); - TEST_VERIFY (strstr (proc.out.buffer, expected) != NULL); + if (strstr (proc.out.buffer, expected) != NULL) + { + /* No change of device. */ + free (expected); + } + else + { + /* The device changed in addition to the inode number. This + happens if /dev/null is bind-mounted from another file + system, so that /dev is on a difference device. */ + expected = xasprintf ("\nDifferences:\n" + "error: descriptor %d changed from \"/dev/null\"" + " to \"/dev\"\n" + "error: descriptor %d changed device ", + free_descriptor, free_descriptor); + TEST_VERIFY (strstr (proc.out.buffer, expected) != NULL); + free (expected); + + /* We assume that the inode number changes, although in theory + it is possible that the directory happens to have the same + inode number as the null device because it is on a different + file system. */ + expected = xasprintf ("\nerror: descriptor %d changed ino ", + free_descriptor); + TEST_VERIFY (strstr (proc.out.buffer, expected) != NULL); + free (expected); + } + support_capture_subprocess_check (&proc, "subprocess_changed_descriptor", 0, sc_allow_stdout); support_capture_subprocess_free (&proc); - free (expected); } static int