From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) by sourceware.org (Postfix) with ESMTPS id 2099B3882100 for ; Fri, 14 Jun 2024 19:00:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2099B3882100 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2099B3882100 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=209.85.221.52 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718391626; cv=none; b=mXDadFB5IV/hbvMXwug5Y/3w1CfjTXSpfpKM34MIk5GX/oNfpmvrrUD8acnf6f9e1H4IZQ9lSnvmSmLwhbofoD/sQOeY4uJoU3Pdmt+y3d3KpUIH0f0IpTKtJV6h6JlHOOpt6OmIS5LiHxEdRYKBkp36EtMJnnuJSwgZBtKZILw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718391626; c=relaxed/simple; bh=tihONDGYpxgXymL2+OUL7JQIx8Mxl5yXTpXxFPOC3/0=; h=Message-ID:Date:MIME-Version:Subject:To:From; b=oXEyzlHuKRBhF3XAYIaAtlDvfXspg0c35uD3Di2Hh+gtj5NVqLqV9W17G9JW/IDQZhn1Ls1xBEVjPnutwUkoPEHgnKgl9p1DHmKHIRMOttigls1x1z9czC6zjG0iCUtq1PP641CZCYrNDP9V4gX3Y64uubpuF5dsbNn3CLVk54Y= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-35f1e35156cso2344030f8f.1 for ; Fri, 14 Jun 2024 12:00:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718391623; x=1718996423; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=zdiMJRIvqu1+4F5o4eOk+eaYUztmGmLM8jJ1WYer6Sw=; b=j9JcKXpg3B7nfFcdbOvHmU6r8sM1tSYpMs9zZlzRBfSR5u9lZx5UlIG88/m04QRRI5 7ynxEc5cszOMza9NX8/mhSXk3YEprwOMyvhz93trjwnmCyXFFam/uklNhTPX7yjT16lb XS9l2+U/HbgpCX7DWx24/OSYq1KVqIB9Ctn/6w6IGm7BCb2sT8QnsfH50xR/8aP9zH7C h14kW50887/J48bQ6p7Qf2YQY2CNRrJBDQuzvqdIY6NszOb/1z/FJgMKq/wDxP9rDO3c ysTSbFBXPsjuDCNCDllPFtV5hnfGN+UpNWnt0xFuyvA8w4QCyVS4awWfgaBxk5FPM4hm s4RA== X-Forwarded-Encrypted: i=1; AJvYcCV9DUuYYVZGc+u0jPyaczX4BOoqZA3PqaKKkLClT24e91/w7no+IqnUOKBbIX5Wrz7jVtOokXwxF9CLPFqxAfLYKaXjY9yt6ym+Tw== X-Gm-Message-State: AOJu0Yww2Fo0v81siNOMcdNBBn5yKOuqpNNRnKuc9lEwQriX5FT8BexW R6hOgvpNJ1mtW++XPbVnGxNGoLChW3BO8dgXIRBbCua3iSHGZHmfz/Pmqw== X-Google-Smtp-Source: AGHT+IEGN3V5oDncPpWFwM4Z6BeelAoNisKXQ+IV+uJGVY5QugZx16QB2KW5dvqaFzjrs7qnQSWEiQ== X-Received: by 2002:a05:6000:144a:b0:360:8738:5c7c with SMTP id ffacd0b85a97d-360873865eamr624323f8f.66.1718391622823; Fri, 14 Jun 2024 12:00:22 -0700 (PDT) Received: from ?IPV6:2001:8a0:f907:4900:3943:9a6c:1c8:1686? ([2001:8a0:f907:4900:3943:9a6c:1c8:1686]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-360750ad1e5sm5169058f8f.55.2024.06.14.12.00.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 14 Jun 2024 12:00:22 -0700 (PDT) Message-ID: Date: Fri, 14 Jun 2024 20:00:10 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCHv3 6/6] gdb/doc: fix parallel build of pdf and dvi files To: Andrew Burgess , gdb-patches@sourceware.org Cc: Tom Tromey References: <412817c6d07836aa2ba2026ac9047fb283c481ea.1717696065.git.aburgess@redhat.com> From: Pedro Alves Content-Language: en-US In-Reply-To: <412817c6d07836aa2ba2026ac9047fb283c481ea.1717696065.git.aburgess@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 2024-06-06 18:49, Andrew Burgess wrote: > When building with 'make -j20 -C gdb/doc all-doc' I often see problems > caused from trying to build some dvi files in parallel with some pdf > files. The problem files are: gdb.dvi and gdb.pdf; stabs.dvi and > stabs.pdf; and annotate.dvi and annotate.pdf. > > The problem is that building these files create temporary files in the > local directory. There's already a race here that two make threads > might try to create these files at the same time. > > But it gets worse, to avoid issues where a failed build could leave > these temporary files in a corrupted state, and so prevent the next > build from succeeding, the recipe for each of these files delete all > the temporary files first, this obviously causes problems if some > other thread has already started the build and is relying on these > temporary files. > > To work around this problem I propose we start using the --build flag > for texi2dvi (which is the same tool used to create the pdf files). > The --build flag allows for the temporary files to be placed into a > sub-directory, e.g. creating gdb.pdf will create the temporary files > in gdb.t2d/pdf/ and gdb.dvi uses gdb.t2d/dvi/, in this way the > temporary files will never clash, and we can easily delete the > specific sub-directory at the start of the recipe to ensure a > successful build. > > Very old versions of texi2dvi don't support --build, so I've added a > configure check for this option. If the option is not supported then > we don't use it. This means we fall back to placing temporary files > in the local directory, which means parallel builds will remain > broken. The --build option is definitely present in texi2dvi version > 6.1, from 2016, so any version after that should be fine. > If we care about old versions enough to support them like this, then couldn't we instead make the subdirectories ourselves and build there, instead of using --build? That way, we would only have one code path, and it would work the same in new or old texi2dvi? I mean, make the rule do something like: mkdir -p pdf && cd pdf && texi2dvi ...