From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9AF70384B13D; Wed, 17 May 2023 20:40:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9AF70384B13D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684356014; bh=dGuJAl4HhVWZpe49s1sbxfd3BC3kW/2ziVk2uYHm3fE=; h=From:To:Subject:Date:From; b=BRQYhclJgxSvvf8lNZvjglj4Oi1NsfcCJDFpV1Xk78BaA7k5yb90Ud+sduzb37pPP wIPUT5qGdBQJMzQeewufLBQQd4zBMsKZd89nSrCSong1Z29SqevDnZmfutMFWqdd9s ahQrcb2xEYZOPmrA0a6ZkFvb2yQNu1SmLED2nzvk= From: "slyfox at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug other/109898] New: 'make install -j' sometimes corrupts 'dir' file for .info files due to parallel 'install-info' calls Date: Wed, 17 May 2023 20:40:14 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: other X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: slyfox at gcc dot gnu.org 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 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109898 Bug ID: 109898 Summary: 'make install -j' sometimes corrupts 'dir' file for .info files due to parallel 'install-info' calls Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: other Assignee: unassigned at gcc dot gnu.org Reporter: slyfox at gcc dot gnu.org Target Milestone: --- In https://github.com/NixOS/nixpkgs/issues/229470 Arnout Engelen noticed th= at 'make install -j' sometimes installs incomplete '$prefix/share/info/dir' fi= le. This happens because 'make install-info' when running in parallel is execut= ing equivalent of: if /<>/bash-5.2-p15/bin/bash -c 'install-info --version' >/dev/null 2>= &1; then \ install-info --dir-file=3D/<>/x86_64-unknown-linux-musl-stage-static-gcc-14.0.0/sha= re/info/dir /<>/x86_64-unknown-linux-musl-stage-static-gcc-14.0.0/share/info/gcc.i= nfo; \ if /<>/bash-5.2-p15/bin/bash -c 'install-info --version' >/dev/null 2>= &1; then \ install-info --dir-file=3D/<>/x86_64-unknown-linux-musl-stage-static-gcc-14.0.0/sha= re/info/dir /<>/x86_64-unknown-linux-musl-stage-static-gcc-14.0.0/share/info/gccin= stall.info; \ if /<>/bash-5.2-p15/bin/bash -c 'install-info --version' >/dev/null 2>= &1; then \ install-info --dir-file=3D/<>/x86_64-unknown-linux-musl-stage-static-gcc-14.0.0/sha= re/info/dir /<>/x86_64-unknown-linux-musl-stage-static-gcc-14.0.0/share/info/cppin= ternals.info; \ if /<>/bash-5.2-p15/bin/bash -c 'install-info --version' >/dev/null 2>= &1; then \ install-info --dir-file=3D/<>/x86_64-unknown-linux-musl-stage-static-gcc-14.0.0/sha= re/info/dir /<>/x86_64-unknown-linux-musl-stage-static-gcc-14.0.0/share/info/cpp.i= nfo; \ if /<>/bash-5.2-p15/bin/bash -c 'install-info --version' >/dev/null 2>= &1; then \ install-info --dir-file=3D/<>/x86_64-unknown-linux-musl-stage-static-gcc-14.0.0/sha= re/info/dir /<>/x86_64-unknown-linux-musl-stage-static-gcc-14.0.0/share/info/gccin= t.info; \ On it's own 'install-info' does not lock $prefix/share/info/dir file atomically. As a result multiple parallel executions of 'install-info' comp= ete and occasionally throw away work of one another. Right now `nixpkgs` works it around as https://github.com/NixOS/nixpkgs/pull/229898: --- gcc-12.2.0/gcc/Makefile.in 2022-08-19 10:09:52.280658631 +0200 +++ gcc-12.2.0-new/gcc/Makefile.in 2023-05-04 14:35:44.401420184 +0200 @@ -3781,6 +3781,11 @@ fi; \ fi +# We don't care about the order in which the info files are built, but +# install-info doesn't support multiple parallel invocations writing to +# the same `dir-file`, so we have to disable parallelism for that reason: +.NOTPARALLEL: install-info + # Install the info files. # $(INSTALL_DATA) might be a relative pathname, so we can't cd into srcdir # to do the install. It might not be enough to handle language-specific 'install-info' targets. What would be the best way to handle this race condition?=