From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-3.7 required=3.0 tests=AWL,BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 700001F54E for ; Mon, 12 Sep 2022 08:51:47 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=clisp.org header.i=@clisp.org header.b="gMbgkLTi"; dkim-atps=neutral Received: from localhost ([::1]:39552 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oXfAP-0007gs-VL for normalperson@yhbt.net; Mon, 12 Sep 2022 04:51:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36026) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oXfAL-0007fM-NH for bug-gnulib@gnu.org; Mon, 12 Sep 2022 04:51:41 -0400 Received: from mo4-p00-ob.smtp.rzone.de ([85.215.255.25]:45075) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oXfAJ-0001xs-Bo for bug-gnulib@gnu.org; Mon, 12 Sep 2022 04:51:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1662972695; s=strato-dkim-0002; d=clisp.org; h=Message-ID:Date:Subject:To:From:Cc:Date:From:Subject:Sender; bh=tZuLMS0X/AChjGb6TIyFd7NQmCeDSk2WkRx/JxIalHw=; b=gMbgkLTighGLqWKkWW9dnFLn3e4ZobKbDoVFl5WkfEDpSQGzN5KSHoifdQlh+onnS9 h7Nn/O9lTIKClLyOfwvRJcmx0882ZBouapcA7PQ8BF8r5FB/xknhwUZsaeq7AzjVbUMm U5fjhyZa7HBL/yFEv/QmbzkfDrhAwWBg76gv2BLWlo+o0G487kvdBBZeAVZWtJb1VB1c 5vTyvQtKxC2g2lW908FEN5avjWoA+zocxH6a7KzdGXHSuanUw+gePkU6evq2fFkTsKuT Td8JmOwutf3orgwlFF94r0iRs1Mm/tTg+bfsZ7D0xbst5V+jIitBGz6psCuV9pc1YtZ/ Eytg== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH0WWb0LN8XZoH94zq68+3cfpOXjfSNRxy8Y8oUX7dSGQ0qOMQc" X-RZG-CLASS-ID: mo00 Received: from nimes.localnet by smtp.strato.de (RZmta 48.0.2 AUTH) with ESMTPSA id J40b3by8C8pZSa9 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Mon, 12 Sep 2022 10:51:35 +0200 (CEST) From: Bruno Haible To: bug-gnulib@gnu.org Subject: supersede: Avoid a failure when writing to /dev/null in Solaris zones Date: Mon, 12 Sep 2022 10:51:34 +0200 Message-ID: <5603766.DvuYhMxLoT@nimes> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Received-SPF: none client-ip=85.215.255.25; envelope-from=bruno@clisp.org; helo=mo4-p00-ob.smtp.rzone.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" On Solaris 11.3 (gcc211.fsffrance.org), I'm seeing a test-supersede failure. It's much like the one seen on Solaris/Illumos and fixed through . The only difference is that here, the open() call fails with error EACCES, not EINVAL. This patch fixes the test failure. 2022-09-12 Bruno Haible supersede: Avoid a failure when writing to /dev/null in Solaris zones. * lib/supersede.c (open_supersede): Treat EACCES (seen on Solaris 11.3) like EINVAL (seen on Illumos). diff --git a/lib/supersede.c b/lib/supersede.c index a72c4f40e8..7fbd619fde 100644 --- a/lib/supersede.c +++ b/lib/supersede.c @@ -83,9 +83,12 @@ open_supersede (const char *filename, int flags, mode_t mode, /* Extra flags for existing devices. */ int extra_flags = #if defined __sun || (defined _WIN32 && !defined __CYGWIN__) - /* open ("/dev/null", O_TRUNC | O_WRONLY) fails with error EINVAL on Solaris - zones. See . - Likewise for open ("NUL", O_TRUNC | O_RDWR) on native Windows. + /* open ("/dev/null", O_TRUNC | O_WRONLY) fails on Solaris zones: + - with error EINVAL on Illumos, see + , + - with error EACCES on Solaris 11.3. + Likewise, open ("NUL", O_TRUNC | O_RDWR) fails with error EINVAL on + native Windows. As a workaround, add the O_CREAT flag, although it ought not to be necessary. */ O_CREAT; @@ -204,7 +207,7 @@ open_supersede (const char *filename, int flags, mode_t mode, } #if defined __sun || (defined _WIN32 && !defined __CYGWIN__) /* See the comment regarding extra_flags, above. */ - else if (errno == EINVAL) + else if (errno == EINVAL || errno == EACCES) { struct stat statbuf;