From patchwork Fri Sep 7 00:37:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 146147 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp524263ljw; Thu, 6 Sep 2018 17:38:24 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbVuWQizUtXpMdfmTPM8QqDWAM1XrRZDOveja3pWJbreenloDCC1/vaiOPu+Duxtaw04R3o X-Received: by 2002:a17:902:7b96:: with SMTP id w22-v6mr5328445pll.24.1536280704257; Thu, 06 Sep 2018 17:38:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536280704; cv=none; d=google.com; s=arc-20160816; b=F05Xpn7yv2Hsq++MuxSe52zVwUmnImghJKOv+on0inoEuYK0bEnikqx4r84TLpFHYe UR1BUbROEhhaRbEHYtD2F0V52CRNyQITIGveTMTEUZxfYWPzj10wCYfmoOqnjZe7IkyE 4uT8cVRdZ3/g//fxg/gKiWi0IiNDamn96e3OhCX0ZabguXC9GOHrbsMaApra+w23iURX +NjXrmbINglXHhANWMNSBowTQNumiXCxlJSitVKd1Y6HW8TZtkRBNRM9cf3E19jR8Nca prahGFVIhANGu/mgNX3L/PHVZMdw/205u8mHPNr0u5wt8DjXZ2ShC2JyQQLQvrD6I+FU +ClQ== 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=Vge4aNCM0no2JUe1nfDuXK3DKZZ6iNY8zErus3b4Ino=; b=XurHfk4+DMBKH6ZzqILgOy3lzJf+j2+ymqizof29DnGx1OEBQA11FREGcw3dy862hS tWYDigKC7RS+NVIaWdq15Hg8I9Lt7tJDnQyGFoEgbHuWF1n+C5CXOZeS0h9XLJCgV+VS I/yNueTJ34TbohuFUbzVdpL0p4HLVD8Q38K2kfAz0IXlb4GbltOl8VSsW7ECSQ8PDz6J bdNBt2IvWQRZp8e2jVm0p2RlG38LRDdUMvSet6ba4dgYmp86OkYT8IY7R2Fq2bzuQFi3 YnXDjH/zZU64DTP3xAnMLCocHAwN1NLGpgEWG1Updw70sq4aaR5pWqnVsnAou0G0VBKY m7QQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=a4P7ivAM; 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 o5-v6si6386292plh.18.2018.09.06.17.38.23; Thu, 06 Sep 2018 17:38:24 -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=a4P7ivAM; 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 S1729813AbeIGFQ0 (ORCPT + 32 others); Fri, 7 Sep 2018 01:16:26 -0400 Received: from mail-by2nam01on0136.outbound.protection.outlook.com ([104.47.34.136]:26290 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729757AbeIGFQZ (ORCPT ); Fri, 7 Sep 2018 01:16:25 -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=Vge4aNCM0no2JUe1nfDuXK3DKZZ6iNY8zErus3b4Ino=; b=a4P7ivAMmccwBOYMBn5YNxdMv4HSZ5+jhLKveSz53Y9SdN5R3QstQhsHqol9E1trvaVV+a/K+3nPrqtMFn1qikPwpCBCCiUHZjpPay3pU8gbAcbsbH//GuK07EWLQ9vtz/SGCJdfcqKPJqEmxaQWZ9wRRcdOEcPdJ1aUniVE5cc= Received: from CY4PR21MB0776.namprd21.prod.outlook.com (10.173.192.22) by CY4PR21MB0757.namprd21.prod.outlook.com (10.173.192.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.1143.1; Fri, 7 Sep 2018 00:38:17 +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:38:17 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Masahiro Yamada , Sasha Levin Subject: [PATCH AUTOSEL 4.14 15/67] kbuild: add .DELETE_ON_ERROR special target Thread-Topic: [PATCH AUTOSEL 4.14 15/67] kbuild: add .DELETE_ON_ERROR special target Thread-Index: AQHURkL1yBMmIR6aU0aijc+iggujkA== Date: Fri, 7 Sep 2018 00:37:30 +0000 Message-ID: <20180907003716.57737-15-alexander.levin@microsoft.com> References: <20180907003716.57737-1-alexander.levin@microsoft.com> In-Reply-To: <20180907003716.57737-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; CY4PR21MB0757; 6:SreIZdmGViEO64kJiXNnGxBda88Z+bwhAw4tNT4ufltGEE07c6i2Gza/2EfmUVrhmX0SSvnbOYqH7mNwsdgw6UrYYe5vXPZxbxZG7d8HNsBRt0dT5wcAGIUVzDa4e3KvfLrflPIYMTfWb+2qze9zb9GCIJSAoGQ0XkepSgvMtDgBhPPKtywGVWzIA8f87NZ4YGAOzj5BpEFn8o/mWci8oBag0Q/HS5zlEGovwykREQ52Hw9au/Ai3oM2WGsBbr03lH+pde0RalPkgjKIp+CsX3zFUFlegUT15MwMyAkMqoRE6qldJj0xWDsXCQKY6/CyLj2tu6NK8O24Nb90cQSfEMwv5wohklxjEsevbz/pNGOfjSlpBlE9IHYgKnlpHtbRvxZt/FiOikhA30yYlMbgQmrrtU0t3o8of1WvjVrz1xi5or1VMFBNDT/t3MpyLZJaiUmo8kiHP/JMWldVixclgw==; 5:OfndktiK9+IyNiDCsltACMPVxHbTInuL1GIX1uyjGn1Nc0F8u1vUK+dufS9PSHVyxEBSxB/piz+9frrP9ORZPHxBlHs5LHTd+fkGwoSwPBOGqwXubcKM65wBTC/05XwZ7LR+Eg1k6FIDI184GU09tJ2iSdPyR6TOPOtrMWjMILY=; 7:4sWmcfRmk13vb+1raVwI24xrZKWg0Sv+WeyCgWCij9U6QN0rAkRyn9ibJF/0aLuv42AW5m1HezF7/QAJf7gjbumrebLUmd4QlP6+qlvbO6uJSfHAt90KE7JEiutd8O7HEw9gYW2wGLRIDaNTBxZO+ew8U5AqpLUOfHxCaKLSmBuayD0jK6pftpW8qnAjSZdHkliE5nlG/FN/3CpAr0pi8zaZmcuJr52MtACqQt4h6SU1Q7mR3j0DvoZhzQd9JYdX x-ms-office365-filtering-correlation-id: fb354d66-7d5b-438a-426d-08d6145a3462 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:CY4PR21MB0757; x-ms-traffictypediagnostic: CY4PR21MB0757: 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:CY4PR21MB0757; BCL:0; PCL:0; RULEID:; SRVR:CY4PR21MB0757; x-forefront-prvs: 07880C4932 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39860400002)(366004)(396003)(136003)(346002)(376002)(199004)(189003)(8936002)(3846002)(81166006)(86612001)(6666003)(5250100002)(81156014)(486006)(99286004)(6486002)(106356001)(10290500003)(107886003)(256004)(14444005)(26005)(11346002)(14454004)(446003)(76176011)(6346003)(5660300001)(10090500001)(110136005)(2616005)(66066001)(186003)(476003)(72206003)(2501003)(54906003)(575784001)(316002)(6436002)(86362001)(97736004)(53936002)(22452003)(6506007)(102836004)(8676002)(6512007)(2900100001)(68736007)(305945005)(7736002)(217873002)(6116002)(1076002)(25786009)(2906002)(36756003)(4326008)(105586002)(478600001)(142923001); DIR:OUT; SFP:1102; SCL:1; SRVR:CY4PR21MB0757; 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: inb31+1gCr6T0/yfSnj9j99YFD9Kc4J7zsewMjvNd21zcxjIPONyIAZVSCepugPc+Lm0SzVeYwZgFQWLAXBSK9rmF7jiCKAFKXkc/3ZqRJb+d/+wSbCn26kKw+v+TSW7FRLNJQWc2JknZIXZ/7f2F3gnOW28Yb1Z2WcG1uCkC0KiZO0IdXkNlszWFtURvDfvTMuSVegEUbboHDUlrvtJCZdGZlCaP1h7mKqOT7J1vgxFm+K090EBZz95YM4mSJyMfvaqXFWDlWJGfbV1eHJzfLusFJxpkpFtxwr9SSDGgJI8s6y66VVTUJYvbABJh4A5+yoGfluQqu6vELTRbcg2kKlx+C7wGPa2scF4RZn0g/Q= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-ID: <87A3D0C830FDBC4AA97A90851D89C8EF@namprd21.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: fb354d66-7d5b-438a-426d-08d6145a3462 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Sep 2018 00:37:30.8505 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR21MB0757 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 fcbbecf92395..a0ad87e869f9 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -403,3 +403,6 @@ endif endef # ############################################################################### + +# delete partially updated (i.e. corrupted) files on error +.DELETE_ON_ERROR: