From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3AA17386102E; Wed, 4 Aug 2021 10:20:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3AA17386102E From: "vincent-gcc at vinc17 dot net" To: gcc-bugs@gcc.gnu.org Subject: [Bug gcov-profile/101773] New: errors when writing to .gcda file are not checked Date: Wed, 04 Aug 2021 10:20:31 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: gcov-profile X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vincent-gcc at vinc17 dot net X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Aug 2021 10:20:32 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101773 Bug ID: 101773 Summary: errors when writing to .gcda file are not checked Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: gcov-profile Assignee: unassigned at gcc dot gnu.org Reporter: vincent-gcc at vinc17 dot net CC: marxin at gcc dot gnu.org Target Milestone: --- When I run a program compiled with -fprofile-generate, this program creates= a .gcda file, but write/close errors are not checked. With GCC 12.0.0 20210729 built from master and an almost full file system for the .gcda file: $ gcc-test -O -fprofile-generate=3Ddir tst.c $ strace ./a.out [...] openat(AT_FDCWD, "dir/#home#vlefevre#a-tst.gcda", O_RDWR|O_CREAT, 0666) =3D= 3 fcntl(3, F_SETLKW, {l_type=3DF_WRLCK, l_whence=3DSEEK_SET, l_start=3D0, l_l= en=3D0}) =3D 0 fcntl(3, F_GETFL) =3D 0x8002 (flags O_RDWR|O_LARGEFIL= E) fstat(3, {st_mode=3DS_IFREG|0644, st_size=3D0, ...}) =3D 0 read(3, "", 1024) =3D 0 lseek(3, 0, SEEK_SET) =3D 0 write(3, "adcg 02B\21\20\217\20\0\0\0\241\10\0\0\0\1\0\0\0\1\0\0\0\0\0\0\1"= ..., 84) =3D -1 ENOSPC (No space left on device) close(3) =3D 0 exit_group(0) =3D ? +++ exited with 0 +++ Note that with gcc (Debian 10.2.1-6) 10.2.1 20210110, I get an error messag= e: $ ./a.out libgcov profiling error:dir/#home#vlefevre#tst.gcda:Error writing but the exit status is also 0, so that the error cannot be detected in scri= pts.=