From patchwork Fri Sep 7 00:36:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 146142 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp522657ljw; Thu, 6 Sep 2018 17:36:14 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYQWohaFGM3P7K+HuvMDG6giXOuVI/5Wbwvn0fWCAyOP5gWKHvy/RQvS474J3iwaShPmxzd X-Received: by 2002:a62:f208:: with SMTP id m8-v6mr5715335pfh.222.1536280574323; Thu, 06 Sep 2018 17:36:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536280574; cv=none; d=google.com; s=arc-20160816; b=Y/y/4TqRiajD0Cl29MoXFBJghjIDPK5hbR8AyKjTiOzO6XNxlkC+vUXAO8XPx7/VvE pbrbHosoghI+MH9zGQzddO34zE2jhPlPTSm+LDuB9866PABE1dTFCKVmvW0N+2ZhxBtT nUlhk9gLfUorD+T4ejXk9v5XFtyr/I3ln1FPr9UK3ESSzIv2bspiM1uX8yq7fjAP08E6 E2WAv4alQukFyZOzkNmgX2skr7V764aBZ6FVKyoSPC0rvCrrG+S+wb0U97sbqvVndq0w avYy3PKL+/gmTeRJqcK3YDKqkrfbVsx/F/PhQuXVJ4Ax3tIis7NiRdojPgq0lbAYuZ+g /JHg== 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=ErhOCor3hzm94uM81gqhWrumPTuqEQbv62tUH4dLWHc=; b=s4Y80Rq5A0BeqdBl0SdUi0BjzgZQWlJSj5kK2FcxUwlzFGc6U4JjqeE6zYC1Yo2405 YCXmzcas/IdjQm7Byh3Bg5EPOGkoS+u3SCjwJG75urQv63sU9TUDsjSuD9vV34zuAfFQ O6ZRLQayfaMNce0RIAH3kSSNuii/BHaCLNqQBtkkaup8Z4h6ITHfVfGBNs+bxxabt+zh LyLgYhiUnsxiLNBpA17Lf1B4H9XSwoi91jFAyuGIkXzlf3GuG2AH9K8vY6ddjUUAMK3N hEMCTsJdkfKeTxrXvw4kEOIJjrWQ9nAu5RE8UG3MEtovatTGISGIXRrIYy7etE9ALLVD CeCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=nmnDGTvf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 f90-v6si6429845plf.30.2018.09.06.17.36.14; Thu, 06 Sep 2018 17:36:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=nmnDGTvf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 S1728548AbeIGFOP (ORCPT + 32 others); Fri, 7 Sep 2018 01:14:15 -0400 Received: from mail-eopbgr710107.outbound.protection.outlook.com ([40.107.71.107]:21288 "EHLO NAM05-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728091AbeIGFOO (ORCPT ); Fri, 7 Sep 2018 01:14:14 -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=ErhOCor3hzm94uM81gqhWrumPTuqEQbv62tUH4dLWHc=; b=nmnDGTvf2TgP6OSKZHrpj+Tae5F3sbwh+ZkDv66HamZ/nRwoO51eRa+MEvZ9sXKX8L7FEsVed/aNJ+ZHHkE9uNFDAbApKyvCDDAsqeUwTKc4JUCNTnLQDjRt0w9MaPvRzzV/fpNq1zPq5axkloX9B5YALSVDMIYU0RG4BATXNF4= Received: from CY4PR21MB0776.namprd21.prod.outlook.com (10.173.192.22) by CY4PR21MB0824.namprd21.prod.outlook.com (10.173.192.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1143.8; Fri, 7 Sep 2018 00:36:08 +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:36:08 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Masahiro Yamada , Sasha Levin Subject: [PATCH AUTOSEL 4.18 22/88] kbuild: add .DELETE_ON_ERROR special target Thread-Topic: [PATCH AUTOSEL 4.18 22/88] kbuild: add .DELETE_ON_ERROR special target Thread-Index: AQHURkLEaoqf5qU2/06kRAIZt9+gFQ== Date: Fri, 7 Sep 2018 00:36:07 +0000 Message-ID: <20180907003547.57567-22-alexander.levin@microsoft.com> References: <20180907003547.57567-1-alexander.levin@microsoft.com> In-Reply-To: <20180907003547.57567-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; CY4PR21MB0824; 6:gpROHgkoBGKjab/yGTKmrOMz1PgysvDAwPA22SJbasZF7fK8pZhEMF114B333fVTCLclYTePr56OdSNit3mGTs5SAA2uKBJB8tnumJ4VfuISZK6vgaMRsMvBZdQrUW9vAjazn9FNl3U4D8shjQRl5uHiHncdNpMiH/9fYvI04vHKZg8CzQ7mMi9oemqATavp9LaZONx2D6aWqZuMyh2oAlHgPiQXE8DS2ajAq2qbWa9cKIIHXTts6jf0kabBbsDBVp0tb13Rq1JHcTBRsZRan0iG5KCQrCrAznhLb7IDOoEK7sDhPmk4tqJlDkPbZ2sPEIxQEuE0fWMny1OueiQETmodsz9EIP0/75IM4rBSUC/LpdeyiG10UTwFUEO1OdHZ7BqJPlcfTRA6UQmuKZ+g8eDQDpnw3erNSaJpn+QFNeLRAj/CXyeD4VZvcslwUVyeGzL9oapBJh70S2oGyQpqYw==; 5:gVodgDeHACX0N5PMOA9LmSaw33KszxqlyNC9Qxy0TI8ktoLX2IvMSTuAMnc3QtBUPIZ7t8+0d9ISkZgVdbRJ3Vj/WihBvVENTSaFZKqmIPlmkMd107Xu+Mj1ou/4flLDm05Coz/36ya1HiCidmLOZZQYiQXuu8JbFIU5baHgdbk=; 7:P/rqAoi2Ww0LFEX0zZtAEOHnLiN3deWG48r8+Ec1sFrRUU6KO1a9Qu+12OOK4NOQaYJSC2t35GF8wUMKyTj0SHTpL24XGrwUBnp2XPfX3I9HYjIBPyekwnNLdRs06myosCOjVU2YaICqUcCk5nb2VtwFbMNaxWw3+PZ4qW/LMuZ5NX9zIXXNWQ92UPiGY4THimsEr3YxiYtaiDNPQ51hvOyTi61y+PJ65zra4VLrlRlsE+JcYl0sEdM34/usFer7 x-ms-office365-filtering-correlation-id: 2ddb56e5-ea73-4a30-fc13-08d61459e719 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:CY4PR21MB0824; x-ms-traffictypediagnostic: CY4PR21MB0824: 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)(8121501046)(5005006)(93006095)(93001095)(3231344)(944501410)(52105095)(2018427008)(3002001)(10201501046)(6055026)(149027)(150027)(6041310)(20161123564045)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699049)(76991033); SRVR:CY4PR21MB0824; BCL:0; PCL:0; RULEID:; SRVR:CY4PR21MB0824; x-forefront-prvs: 07880C4932 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(366004)(396003)(39860400002)(376002)(346002)(136003)(199004)(189003)(22452003)(14444005)(256004)(102836004)(6506007)(217873002)(10290500003)(186003)(26005)(5660300001)(4326008)(6346003)(81156014)(81166006)(110136005)(54906003)(72206003)(316002)(1076002)(6116002)(3846002)(8936002)(107886003)(14454004)(86612001)(2900100001)(105586002)(106356001)(5250100002)(86362001)(76176011)(2501003)(53936002)(10090500001)(68736007)(66066001)(36756003)(6436002)(99286004)(6512007)(486006)(25786009)(2906002)(6486002)(478600001)(7736002)(305945005)(2616005)(476003)(11346002)(97736004)(8676002)(446003)(142923001); DIR:OUT; SFP:1102; SCL:1; SRVR:CY4PR21MB0824; H:CY4PR21MB0776.namprd21.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX: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: BeUURZUSuOKUS2+S7rdFExkbeHK3p9NSmTUKygyVf+KQICyGgvqlltByiIJIYfr4Ddwa/SN7bz6V0CxK6coiBK9qeEpcRD01/xoeXap2sa/oTmtWM0qFNJEtWzV9dC2Q+uRA3RLiHYNZHWl3vgSyOoG9y23w5B6z3wtlhMpOmyh99Ot7tIyBMVKed2m83sUI/lLc0pibu8QtyZAzOjKGy4LCCgE/1+R9P97+uKbSIXcVKzEEK+8YkDxw5qTFtKLYi70C4ePZMboStjxWepiR8e8ryS3h65x6kmAtOvQhmFEg9+r/lfm6g0f650/je59HAgK0k0GGNM/uzRAajtirb+i98nCdBRt7kPuZcmFHV/I= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-ID: <6956467F78DF504D9258B68FC199E95D@namprd21.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2ddb56e5-ea73-4a30-fc13-08d61459e719 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Sep 2018 00:36:07.9907 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR21MB0824 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 86321f06461e..ed303f552f9d 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -400,3 +400,6 @@ endif endef # ############################################################################### + +# delete partially updated (i.e. corrupted) files on error +.DELETE_ON_ERROR: