From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 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 C785F1F47C for ; Tue, 10 Jan 2023 16:38:29 +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.a=rsa-sha256 header.s=strato-dkim-0002 header.b=fnh578Io; dkim-atps=neutral Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pFHd8-00011Z-Mc; Tue, 10 Jan 2023 11:37:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pFHd6-0000zx-U7 for bug-gnulib@gnu.org; Tue, 10 Jan 2023 11:37:40 -0500 Received: from mo4-p00-ob.smtp.rzone.de ([85.215.255.22]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pFHd4-0004yV-JO for bug-gnulib@gnu.org; Tue, 10 Jan 2023 11:37:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1673368655; s=strato-dkim-0002; d=clisp.org; h=Message-ID:Date:Subject:To:From:Cc:Date:From:Subject:Sender; bh=WfE5HC8Q07+YYDQHrmCXgnklOf5rEfe3dhWHUbAalsQ=; b=fnh578Io1eIyvjAzUfJiuAS/5XubUkcL8+HmoG2vK7zv/crSXjO7BViiwe3JRRHJ9q mqTb86DSYD522rz5ch/XKHPdItTEHBKatMTcr9PmJIyC2AOgv6zdQmH1bJ/A9b4lG6K4 8Wv2j8xoj+tNNcD8tMZgMj1PDE3lyjrl7H14+dJ2pk5k6ZGOEEqgYulYSuqckEgFmm8P oMRpQvR/TOKtVzyKjFTEKL+ORPiT9FezCyRMYmlPKDBb3VLo6Rort/g4fNAeRZ2fXSBV xN4PSJuLETepjIBpk1bpOMIZ7b1adHf39ngGVlq/3kKPQMNjXMUcq9A2qgtrd/tmQIKO a9zQ== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH0WWb0LN8XZoH94zq68+3cfpOUjqRYPXDe+rjXydTXYrbjPrdb0g==" X-RZG-CLASS-ID: mo00 Received: from nimes.localnet by smtp.strato.de (RZmta 48.2.1 AUTH) with ESMTPSA id t05890z0AGbYWgI (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Tue, 10 Jan 2023 17:37:34 +0100 (CET) From: Bruno Haible To: bug-gnulib@gnu.org Subject: Fix some test failures on Android =?UTF-8?B?4oml?= 11 Date: Tue, 10 Jan 2023 17:37:34 +0100 Message-ID: <4980298.ezd0NqBDhE@nimes> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" Received-SPF: none client-ip=85.215.255.22; 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, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_NONE=0.001 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-bounces+normalperson=yhbt.net@gnu.org On Android 11, I'm seeing these test failures from a testdir: =46AIL: test-fclose =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D fdsan: attempted to close file descriptor 3, expected to be unowned, actual= ly owned by FILE* 0xa70c2ecc Aborted =46AIL test-fclose (exit status: 134) =46AIL: test-fdopen =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D fdsan: failed to exchange ownership of file descriptor: fd 1 is owned by FI= LE* 0xb4841a0c, was expected to be unowned Aborted =46AIL test-fdopen (exit status: 134) =46AIL: test-fflush =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D fdsan: attempted to close file descriptor 3, expected to be unowned, actual= ly owned by FILE* 0xab8014dc Aborted =46AIL test-fflush (exit status: 134) =46AIL: test-fgetc =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D fdsan: attempted to close file descriptor 3, expected to be unowned, actual= ly owned by FILE* 0xab20531c Aborted =46AIL test-fgetc (exit status: 134) =46AIL: test-fputc =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D fdsan: attempted to close file descriptor 3, expected to be unowned, actual= ly owned by FILE* 0xabe0299c Aborted =46AIL test-fputc (exit status: 134) =46AIL: test-fread =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D fdsan: attempted to close file descriptor 3, expected to be unowned, actual= ly owned by FILE* 0xb2c8001c Aborted =46AIL test-fread (exit status: 134) =46AIL: test-fseeko4.sh =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D fdsan: attempted to close file descriptor 3, expected to be unowned, actual= ly owned by FILE* 0xb31c5d7c Aborted =46AIL test-fseeko4.sh (exit status: 1) =46AIL: test-ftello4.sh =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D fdsan: attempted to close file descriptor 3, expected to be unowned, actual= ly owned by FILE* 0xb4fc246c Aborted =46AIL test-ftello4.sh (exit status: 1) =46AIL: test-fwrite =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D fdsan: attempted to close file descriptor 3, expected to be unowned, actual= ly owned by FILE* 0xa6d067dc Aborted =46AIL test-fwrite (exit status: 134) These test failures are all triggered by the file-descriptor sanitizer This patch avoids the failures. 2023-01-10 Bruno Haible Fix some test failures on Android =E2=89=A5 11. * tests/test-fclose.c (main): On Android, avoid triggering the file-descriptor sanitizer (fdsan). * tests/test-fdopen.c (main): Likewise. * tests/test-fflush.c (main): Likewise. * tests/test-fgetc.c (main): Likewise. * tests/test-fputc.c (main): Likewise. * tests/test-fread.c (main): Likewise. * tests/test-fseeko4.c (main): Likewise. * tests/test-ftello4.c (main): Likewise. * tests/test-fwrite.c (main): Likewise. diff --git a/tests/test-fclose.c b/tests/test-fclose.c index 5eda8fa672..5df500634e 100644 =2D-- a/tests/test-fclose.c +++ b/tests/test-fclose.c @@ -75,6 +75,7 @@ main (int argc, char **argv) =20 /* Test that fclose() sets errno if someone else closes the stream fd behind the back of stdio. */ + #if !defined __ANDROID__ /* fdsan */ { FILE *fp =3D fdopen (fd, "w+"); ASSERT (fp !=3D NULL); @@ -83,6 +84,7 @@ main (int argc, char **argv) ASSERT (fclose (fp) =3D=3D EOF); ASSERT (errno =3D=3D EBADF); } + #endif =20 /* Test that fclose() sets errno if the stream was constructed with an invalid file descriptor. */ diff --git a/tests/test-fdopen.c b/tests/test-fdopen.c index 113bde0c83..cf28f8e7e5 100644 =2D-- a/tests/test-fdopen.c +++ b/tests/test-fdopen.c @@ -33,9 +33,14 @@ main (void) failure, since the behavior is not well-defined on invalid file descriptors, so try fdopen 1000 times and if that's not enough to fail due to EMFILE, so be it. */ + #if defined __ANDROID__ /* fdsan */ + #define COUNT 1 + #else + #define COUNT 1000 + #endif =20 int i; =2D for (i =3D 0; i < 1000; i++) + for (i =3D 0; i < COUNT; i++) { errno =3D 0; if (! fdopen (STDOUT_FILENO, "w")) diff --git a/tests/test-fflush.c b/tests/test-fflush.c index c996b18c25..f43d9788eb 100644 =2D-- a/tests/test-fflush.c +++ b/tests/test-fflush.c @@ -148,6 +148,7 @@ main (void) =20 /* Test that fflush() sets errno if someone else closes the stream fd behind the back of stdio. */ + #if !defined __ANDROID__ /* fdsan */ { FILE *fp =3D fopen ("test-fflush.txt", "w"); ASSERT (fp !=3D NULL); @@ -158,6 +159,7 @@ main (void) ASSERT (errno =3D=3D EBADF); fclose (fp); } + #endif =20 /* Test that fflush() sets errno if the stream was constructed with an invalid file descriptor. */ diff --git a/tests/test-fgetc.c b/tests/test-fgetc.c index 59ab4098d4..c8c65f58aa 100644 =2D-- a/tests/test-fgetc.c +++ b/tests/test-fgetc.c @@ -54,6 +54,7 @@ main (int argc, char **argv) =20 /* Test that fgetc() sets errno if someone else closes the stream fd behind the back of stdio. */ + #if !defined __ANDROID__ /* fdsan */ { FILE *fp =3D fopen (filename, "r"); ASSERT (fp !=3D NULL); @@ -64,6 +65,7 @@ main (int argc, char **argv) ASSERT (ferror (fp)); fclose (fp); } + #endif =20 /* Test that fgetc() sets errno if the stream was constructed with an invalid file descriptor. */ diff --git a/tests/test-fputc.c b/tests/test-fputc.c index 2f0f1a33a9..3a9e7c38ac 100644 =2D-- a/tests/test-fputc.c +++ b/tests/test-fputc.c @@ -45,6 +45,7 @@ main (int argc, char **argv) =20 /* Test that fputc() on an unbuffered stream sets errno if someone else closes the stream fd behind the back of stdio. */ + #if !defined __ANDROID__ /* fdsan */ { FILE *fp =3D fopen (filename, "w"); ASSERT (fp !=3D NULL); @@ -56,6 +57,7 @@ main (int argc, char **argv) ASSERT (ferror (fp)); fclose (fp); } + #endif =20 /* Test that fputc() on an unbuffered stream sets errno if the stream was constructed with an invalid file descriptor. */ diff --git a/tests/test-fread.c b/tests/test-fread.c index 54e9d631ae..d6d16ec3d9 100644 =2D-- a/tests/test-fread.c +++ b/tests/test-fread.c @@ -54,6 +54,7 @@ main (int argc, char **argv) =20 /* Test that fread() sets errno if someone else closes the stream fd behind the back of stdio. */ + #if !defined __ANDROID__ /* fdsan */ { FILE *fp =3D fopen (filename, "r"); char buf[5]; @@ -65,6 +66,7 @@ main (int argc, char **argv) ASSERT (ferror (fp)); fclose (fp); } + #endif =20 /* Test that fread() sets errno if the stream was constructed with an invalid file descriptor. */ diff --git a/tests/test-fseeko4.c b/tests/test-fseeko4.c index f509702b3e..ad90a2c990 100644 =2D-- a/tests/test-fseeko4.c +++ b/tests/test-fseeko4.c @@ -33,6 +33,7 @@ main (int argc, char **argv) { FILE *fp =3D fopen (filename, "r"); ASSERT (fp !=3D NULL); + #if !defined __ANDROID__ /* fdsan */ setvbuf (fp, NULL, _IONBF, 0); ASSERT (ftell (fp) =3D=3D 0); ASSERT (fseeko (fp, 0, SEEK_END) =3D=3D 0); @@ -41,6 +42,7 @@ main (int argc, char **argv) errno =3D 0; ASSERT (fseeko (fp, 0, SEEK_SET) =3D=3D -1); ASSERT (errno =3D=3D EBADF); + #endif fclose (fp); } =20 diff --git a/tests/test-ftello4.c b/tests/test-ftello4.c index b1ff8268f6..590c17b678 100644 =2D-- a/tests/test-ftello4.c +++ b/tests/test-ftello4.c @@ -33,11 +33,13 @@ main (int argc, char **argv) { FILE *fp =3D fopen (filename, "r"); ASSERT (fp !=3D NULL); + #if !defined __ANDROID__ /* fdsan */ setvbuf (fp, NULL, _IONBF, 0); ASSERT (close (fileno (fp)) =3D=3D 0); errno =3D 0; ASSERT (ftello (fp) =3D=3D (off_t)-1); ASSERT (errno =3D=3D EBADF); + #endif fclose (fp); } =20 diff --git a/tests/test-fwrite.c b/tests/test-fwrite.c index 07f8b73e03..503e849b47 100644 =2D-- a/tests/test-fwrite.c +++ b/tests/test-fwrite.c @@ -45,6 +45,7 @@ main (int argc, char **argv) =20 /* Test that fwrite() on an unbuffered stream sets errno if someone else closes the stream fd behind the back of stdio. */ + #if !defined __ANDROID__ /* fdsan */ { FILE *fp =3D fopen (filename, "w"); char buf[5] =3D "world"; @@ -57,6 +58,7 @@ main (int argc, char **argv) ASSERT (ferror (fp)); fclose (fp); } + #endif =20 /* Test that fwrite() on an unbuffered stream sets errno if the stream was constructed with an invalid file descriptor. */