From patchwork Fri Sep 7 00:38:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 146154 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp532796ljw; Thu, 6 Sep 2018 17:50:06 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZJLpVF63zDOSVDwvMh6ggYCLIPt/rFUQTxKbf1L6G8M/qLe47g6xK8BA1hvyTFhW+fAjZQ X-Received: by 2002:a63:bd41:: with SMTP id d1-v6mr5575006pgp.309.1536281406678; Thu, 06 Sep 2018 17:50:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536281406; cv=none; d=google.com; s=arc-20160816; b=Sy7CnNfoNEBWnFUfkc4pxxs2cniyDGa+Z5G8I3fwpbzwejZiNqg7Fgjy02tNcO5w4i UXj0gS7dLJhtBCwClz5WurMggeO/R/3OiUHI/F6sOxmvunLURCO2BVMDc8qDknENm8OS IluiqXL5QJc9tnFGNzGfJO6r6drrutO+xSYFNMRQdb2yQGAEvuazSmF7YO34VBFGoaMf tS05I/s4dvlk/FE56VZzBDyoriVzPMbgFfZA9Lc18I+YD4a6Hq011BbJAQkSGuC5ZGzJ 8HiOBL0Akx3jcWjYWsmIFA10BLqa+q5JatbMqniQsUXs0/uUmplW7/BUFf2XyQWIa/g8 FRyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-id:spamdiagnosticmetadata:spamdiagnosticoutput :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=gbNSoKidFIHCUHMnDGke3lolfFYikLnVW/3KcFpATaw=; b=EDiGau+Fy0qnYVcKg3KTO32HvqbDKKMoGsBfVl0Nud0HkyAbnDg0Z0iu6PHtA8KA6Z jE+ATKs7jI7T2Y2GY8EwQ+fBeU8N+J9zcwG84H+DZdykWhx6lLrvVAErx/usa6KIVGhx zHxEWpLwsBedl/CkfMO5KSSAB/QqaXBUybtz1qWZPn07EqGB+aejl5d4cvQPtU5TJgmd lUOxd3gx8BSvvtSOHvo/nN2FR7bZQZT8ay7qpG307pq1AYhnzTmxTEBMNYQh9n0XVumQ WgobLhd1ncqZ4J1eLzXA1cR5zuwc0xIFrceI1h0ClTYiLlLOVXv93f06yO25AFr15ucN A2LA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=d3uAjRCR; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q4-v6si6861443pgh.412.2018.09.06.17.50.06; Thu, 06 Sep 2018 17:50:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=d3uAjRCR; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728891AbeIGF2N (ORCPT + 13 others); Fri, 7 Sep 2018 01:28:13 -0400 Received: from mail-sn1nam01on0098.outbound.protection.outlook.com ([104.47.32.98]:26944 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727820AbeIGFSu (ORCPT ); Fri, 7 Sep 2018 01:18:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gbNSoKidFIHCUHMnDGke3lolfFYikLnVW/3KcFpATaw=; b=d3uAjRCRXnwBHnzGwJQUknMtd/PukAa1XQU31hF/Sbb7E8PBFpq3aj4qeQ/dO9KucJbUWCXP2mFTsELK6UzGyT8ynU1S5HLt82uBECjDTT18CXcT5D76GsdGkBWpixWU5VD4PhwemLCFAMx9NIrOakgbZaDPBR9om8IC9O3EdVQ= Received: from CY4PR21MB0776.namprd21.prod.outlook.com (10.173.192.22) by CY4PR21MB0149.namprd21.prod.outlook.com (10.173.189.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1143.7; Fri, 7 Sep 2018 00:40:40 +0000 Received: from CY4PR21MB0776.namprd21.prod.outlook.com ([fe80::7c3a:eea8:1391:1611]) by CY4PR21MB0776.namprd21.prod.outlook.com ([fe80::7c3a:eea8:1391:1611%7]) with mapi id 15.20.1143.008; Fri, 7 Sep 2018 00:40:40 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Masahiro Yamada , Sasha Levin Subject: [PATCH AUTOSEL 4.9 09/43] kbuild: add .DELETE_ON_ERROR special target Thread-Topic: [PATCH AUTOSEL 4.9 09/43] kbuild: add .DELETE_ON_ERROR special target Thread-Index: AQHURkMWAkSSYRDh1k2WMn7gKdVKRA== Date: Fri, 7 Sep 2018 00:38:24 +0000 Message-ID: <20180907003816.57852-9-alexander.levin@microsoft.com> References: <20180907003816.57852-1-alexander.levin@microsoft.com> In-Reply-To: <20180907003816.57852-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; CY4PR21MB0149; 6:cDWnEN/YyJ4CvXqZGfzXp2PzsUIy4S30fbsCA0QvtpqdKs+jO2MdL50Dgiox7tBM6+maody9EomblOE9PODEkLw8I4gNJbUlDw+2t6RNWwRaFdKRqemNDkEucu6M4bTm/uGmiVlVHKSibpg7qN68Y0nZ3Sjas5SGiBcUNKWFpHf3hFEXY3CH0eh8AiCpdgMT+K4mrv0EKs/JGehFmfOudeeu764TRFd985rMw6VCA+JLVskgE0C3TNBNiUgKoEYFbNQb9ED9pm+wzZWrZXOessO0kukXrADb4YtT8Zo1XHFrdWARmoqGJn/dqRPJV61ZKbP/owdf1/5cR5T5iY9xeLC6rain71pHhhIChdx2jfHs6Hx1rDnGmp34T37hYxnkvi6HL2jgC/Yu4VrhX372w9NPhcmB08331GQPJ/GI/8DxKbS3TVm+qzvrLCFosWiQH7M7etRZWBj1haQDAEkXtw==; 5:i+CbIru4OPhrD2BV4pPycSOCAVzXa73/HKu7xH14YmGZKGth/evvY/3XSaLqDk0W1DcYgsCb5Bxh6dG6fsNdregcO7U4ADy7hkFLj8Hi3nOxI5aiBtCiXzqJGOlRhhgyORNiLZWuMiAlUVJ5R6Yt0On1N9/szLFwvJdWUrlf2dw=; 7:sX0Ce2MMF7vUgBuFNCYkNRYk+Qp/mA9EV936MJPo4YyPU9OkJqykKOWYX2y8djHxO4rJis9/+FlMSFS2ihWIYpy+9Ey7pqAiCxZV98EjYcdCjxL9u3kT0hG43gUXlfqeq7LGE2p1hL2E8PrZyRD6cmMiMrEInALfNqIAIHAanu8corPafxFiN5ufNbJD0zQWJcelNlyUq2k1UxoJJXFCB59lC+P6zPXCiwPKC+xI620u8t7TRzuB9N7b+6+ZHUGT x-ms-office365-filtering-correlation-id: 8c8bd02c-cfb4-4b0c-f70e-08d6145a8933 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(4618075)(2017052603328)(7193020); SRVR:CY4PR21MB0149; x-ms-traffictypediagnostic: CY4PR21MB0149: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231344)(944501410)(52105095)(2018427008)(93006095)(93001095)(10201501046)(3002001)(6055026)(149027)(150027)(6041310)(20161123560045)(20161123558120)(20161123564045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699049)(76991033); SRVR:CY4PR21MB0149; BCL:0; PCL:0; RULEID:; SRVR:CY4PR21MB0149; x-forefront-prvs: 07880C4932 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(366004)(346002)(376002)(39860400002)(396003)(136003)(189003)(199004)(476003)(2616005)(105586002)(76176011)(446003)(486006)(14444005)(6666003)(2900100001)(256004)(217873002)(66066001)(22452003)(1076002)(6346003)(316002)(86362001)(25786009)(4326008)(26005)(110136005)(102836004)(54906003)(86612001)(107886003)(6116002)(11346002)(5660300001)(6506007)(2501003)(6486002)(5250100002)(14454004)(7736002)(8936002)(68736007)(3846002)(53936002)(97736004)(6436002)(10090500001)(6512007)(305945005)(478600001)(99286004)(106356001)(81156014)(2906002)(10290500003)(36756003)(81166006)(186003)(8676002)(72206003)(142923001); DIR:OUT; SFP:1102; SCL:1; SRVR:CY4PR21MB0149; H:CY4PR21MB0776.namprd21.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-message-info: 5eaHBr3VUrC0rxqfxU5ZW98W/2SYMesH9s2Q3nlPTn9VVAR0jKtoetavtum44KDK1YJh3onERcoWXi4Dq5WsbhIxi9vsB0uAM01oQDN9Sl7PE4ql47YWlIfvWsPrVGIHy79y34McL3zpLCvgT2wCjLObkV47E+2my188BB5of6uuUmpRPUI0VsQOcn3a1dOK6I2BtNjOkG/6pTpKeQpeN5kMidxHK4e4tlu06iMJLOPSEUZS3O/USUi2gBPzz7HRy6rSWKsLrvKtuwtr7fSZD8APthjBVKNROLbVnAAjLgNQMSKPS0af9cn0WIqVRitxX7zjrWHthoZG4Pxr+sMsZ0B4/1NZoGFpqbcmJ/UU3p4= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-ID: <609ED9A4CC1A1B4C8A78CA261EDA279F@namprd21.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8c8bd02c-cfb4-4b0c-f70e-08d6145a8933 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Sep 2018 00:38:24.9716 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR21MB0149 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Masahiro Yamada [ Upstream commit 9c2af1c7377a8a6ef86e5cabf80978f3dbbb25c0 ] If Make gets a fatal signal while a shell is executing, it may delete the target file that the recipe was supposed to update. This is needed to make sure that it is remade from scratch when Make is next run; if Make is interrupted after the recipe has begun to write the target file, it results in an incomplete file whose time stamp is newer than that of the prerequisites files. Make automatically deletes the incomplete file on interrupt unless the target is marked .PRECIOUS. The situation is just the same as when the shell fails for some reasons. Usually when a recipe line fails, if it has changed the target file at all, the file is corrupted, or at least it is not completely updated. Yet the file’s time stamp says that it is now up to date, so the next time Make runs, it will not try to update that file. However, Make does not cater to delete the incomplete target file in this case. We need to add .DELETE_ON_ERROR somewhere in the Makefile to request it. scripts/Kbuild.include seems a suitable place to add it because it is included from almost all sub-makes. Please note .DELETE_ON_ERROR is not effective for phony targets. The external module building should never ever touch the kernel tree. The following recipe fails if include/generated/autoconf.h is missing. However, include/config/auto.conf is not deleted since it is a phony target. PHONY += include/config/auto.conf include/config/auto.conf: $(Q)test -e include/generated/autoconf.h -a -e $@ || ( \ echo >&2; \ echo >&2 " ERROR: Kernel configuration is invalid."; \ echo >&2 " include/generated/autoconf.h or $@ are missing.";\ echo >&2 " Run 'make oldconfig && make prepare' on kernel src to fix it."; \ echo >&2 ; \ /bin/false) Signed-off-by: Masahiro Yamada Signed-off-by: Sasha Levin --- scripts/Kbuild.include | 3 +++ 1 file changed, 3 insertions(+) -- 2.17.1 diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 63774307a751..8f8965608ee3 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -394,3 +394,6 @@ endif endef # ############################################################################### + +# delete partially updated (i.e. corrupted) files on error +.DELETE_ON_ERROR: