From patchwork Fri May 19 14:01:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerald Pfeifer X-Patchwork-Id: 96440 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1258595vqo; Fri, 19 May 2023 07:02:52 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ65439oYbSfzEwqd2Yjf20oCJtj8LdF7M8sybFgy0F/fGsc9OW+qZX8VjuannQZ3osXoAO9 X-Received: by 2002:a50:ed99:0:b0:506:c231:95ac with SMTP id h25-20020a50ed99000000b00506c23195acmr1738996edr.16.1684504972418; Fri, 19 May 2023 07:02:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684504972; cv=none; d=google.com; s=arc-20160816; b=KV9ZI4fyrm8jPTrJEeadr3oefMaWFELGHHZ9lvyJXxXsFfE1bBU3B7y745OIKpmwQy T1hFrKFsCe71/133lxZsU5RNlg7SC7xbvPPh0+PfHQCpvMiXCBKvBIsBZSMaq1SbM8uP 44C4CSVzHVAL+uE66GeP0/BDU4H3OjMxSYwraXDXdUGsA2PbYsQToyI0RAkIKr3/25+Q zmCt70fG0UCtHXM/3H94zZ6w9QD8xW6vBlst150U8BXbgKQg8P8soN8MmZt01WdMQ7yI g2+GJGPX8wSGSnFkf3z2BEWPiPgLU77PX5FVa8q59RNYUx+yAk9MiinxwyW2NGXN7GUJ 81tQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:message-id:mime-version:subject :cc:to:from:date:dmarc-filter:delivered-to; bh=pfEEYGZj/quf3ldfybDEG7crD+gaai9Fp4kqd58LClw=; b=SN24JJhrw7rpoBGvVpA5bf1nc+NoA3SCcSTJfa2e8rCfz4F8ao9a0UkgzVsCC1K34M Pz5xWIdcoSeMNILdclNgsT1x/8dXLjykiL529hqoHwNOUX3lkX4OMEpV0XhDERuuewAH qTHPBz8ug53r6XF9CM3OdeOOgrPDnTgmFbCELvwB2O/QiPRZYsd/EID3h3A5sYygKtNP NhPksLSjsLN++dW0hQuBxGAIfKTOv7DG4C9UuNtb2IYd6Y4y92d9qsJ9CWf7tLMNTL3Z f9HquIH6nmIAHVCzGICkhoekqhjaUX9wT0oZVMNjgTzDhmcm2OjtDe+6h/ESikPk5Ozq G0iw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id h11-20020aa7c60b000000b0050d9b58861asi2762730edq.251.2023.05.19.07.02.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 07:02:52 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 829083836E82 for ; Fri, 19 May 2023 14:02:31 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from hamza.pair.com (hamza.pair.com [209.68.5.143]) by sourceware.org (Postfix) with ESMTPS id 41F9F3857C44 for ; Fri, 19 May 2023 14:02:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 41F9F3857C44 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=pfeifer.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=pfeifer.com Received: from hamza.pair.com (localhost [127.0.0.1]) by hamza.pair.com (Postfix) with ESMTP id 1369B33E6E; Fri, 19 May 2023 10:02:06 -0400 (EDT) Received: from [192.168.33.73] (unknown [213.208.157.36]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by hamza.pair.com (Postfix) with ESMTPSA id E8F9E33E85; Fri, 19 May 2023 10:02:04 -0400 (EDT) Date: Fri, 19 May 2023 16:01:59 +0200 (CEST) From: Gerald Pfeifer To: gcc-patches@gcc.gnu.org cc: =?iso-8859-2?q?Arsen_Arsenovi=E6?= Subject: [pushed] wwwdocs: preprocess: Check whether input files exist MIME-Version: 1.0 X-Scanned-By: mailmunge 3.11 on 209.68.5.143 Message-Id: <20230519140206.1369B33E6E@hamza.pair.com> X-Spam-Status: No, score=-9.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_BARRACUDACENTRAL, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766331486146887579?= X-GMAIL-MSGID: =?utf-8?q?1766331486146887579?= This has not come up in all those years since the preprocess script usually is invoked from other scripts, notably post commit hooks. It can, however, be invoked manually, and error handling is generally a good thing. Instead of cat: foo/bar/index.html: No such file or directory New file /www/gcc/htdocs/foo/bar/index.html and an empty output file, we now get Input file foo/bar/index.html not found. when invoking `preprocess foo/bar/index.html`. Pushed. Gerald --- bin/preprocess | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bin/preprocess b/bin/preprocess index c62ba457..c6d34c4b 100755 --- a/bin/preprocess +++ b/bin/preprocess @@ -155,6 +155,11 @@ process_file() # Strip possibly leading "./". f=`echo $1 | sed -e 's#^\./##'` + if [ ! -f "$SOURCETREE/$f" ] wwwdocs:; then + echo "Input file $f not found." + return + fi + if [ ! -d "$DESTTREE/`dirname $f`" ] wwwdocs:; then echo "Creating new directory `dirname $f`." mkdir -p $DESTTREE/`dirname $f`