From patchwork Fri Sep 7 00:39:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 146151 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp526966ljw; Thu, 6 Sep 2018 17:42:01 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdac0seOK0/fumwLe46IAeqLutOaejdLRyOj24xR2jeQIg6KNcPluAt3xlN9RUm99eiSJ+ps X-Received: by 2002:a62:fcd2:: with SMTP id e201-v6mr5788460pfh.101.1536280921175; Thu, 06 Sep 2018 17:42:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536280921; cv=none; d=google.com; s=arc-20160816; b=lV1cpgYT0MSB2Z2DM46jWesULkOyRn1ww/y4Y+JBmEkeMgbkJPMoytHKHFsiOjftaQ 0TurUkokfXThuwuUSnSW5MJcF8sOPp8ITDgV23dIoQm5HCg1g0ljHXZjmq8rRDb8jAt2 qutFaQkriFn05Bk8dhxi5SUx4Mgs2MX7ZNFz+V65qWfddZSZgwOZyAunEB5pXSi41oiC k8OGFWXo2bNoUUR+hcyiVCf7uhqHZ5U7HKhCbNcdxXTDbALLQwZuNW/wBeyOsyuS2yEM af9iff/QE5gjvY72bsfvcZuzseYSEtYxUxTunTTlJRKoyExWdLvkO90VFhXj6UlD3eCj 6KqQ== 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=EMpN0ksWjWxoYWvK/oJbX40bCE+p0uPR2LMNmPHp+5w=; b=ZAFFIY7MAmpKZvkx5uh6PwMR10vu+gRhzuEgnd200Gxbo3C+9q/iiKf6KcDx/4b7Ob onPyyvFvCXc4DCefjjy/txljYFakNkcoBx2jCQh4hr1lkowvHTq33SJWOAQulZ07O2Af DqcGPjscMBlXAat7GkOtkPFOGgtqq5sSZkg+sFYAgVyov5SvP4cCjYhb9vSowap6Q8fr QIu3SFcL4mG085QNqDtSCRvAyPbPKPURUtqC/NLyvaULI+Rh04GtjyXzm0oFRjCzZzcP zllEUIYVaVgrioqezLxXat5ug13xM3et+e1v0lV0vJAUpc5YIssl+GPuSsRiGjBwn+1k 6C4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=ABKsM+ei; 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 y187-v6si6747021pfy.151.2018.09.06.17.42.00; Thu, 06 Sep 2018 17:42:01 -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=ABKsM+ei; 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 S1728551AbeIGFUF (ORCPT + 13 others); Fri, 7 Sep 2018 01:20:05 -0400 Received: from mail-cys01nam02on0134.outbound.protection.outlook.com ([104.47.37.134]:29449 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731014AbeIGFTj (ORCPT ); Fri, 7 Sep 2018 01:19:39 -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=EMpN0ksWjWxoYWvK/oJbX40bCE+p0uPR2LMNmPHp+5w=; b=ABKsM+eivGV4bjOp0aTJR7epl+nnBMREFzzeftBEqSlD0fFmNVn5eYoFDRBZVnsDsjiazifCpMRwtDhRHcbIeGw1NTR+9JzJA2kR9lB0a4AghyrqOg9zKgxNy9DJimnAprVVtFGPmftSzUVKmiMlvGmzjtuDM5+SO2co6NO+JEI= Received: from CY4PR21MB0776.namprd21.prod.outlook.com (10.173.192.22) by CY4PR21MB0853.namprd21.prod.outlook.com (10.173.192.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1143.1; Fri, 7 Sep 2018 00:41:28 +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:41:28 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Masahiro Yamada , Sasha Levin Subject: [PATCH AUTOSEL 4.4 08/30] kbuild: add .DELETE_ON_ERROR special target Thread-Topic: [PATCH AUTOSEL 4.4 08/30] kbuild: add .DELETE_ON_ERROR special target Thread-Index: AQHURkMrf7oKHs+Hb0a0ho+pYx56lA== Date: Fri, 7 Sep 2018 00:39:01 +0000 Message-ID: <20180907003853.57942-8-alexander.levin@microsoft.com> References: <20180907003853.57942-1-alexander.levin@microsoft.com> In-Reply-To: <20180907003853.57942-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; CY4PR21MB0853; 6:oKn4zyQQJtQYKLqUZdqsM7UT80Goe+AO3sgfVJL54X+ftpkx3TNG5yovNcCSAK5UPC4yscbzfhTfrY9WQiMlIv3Zi6yW/7BioKkmKSSHtLTKtE1i6iYRC8HYICD0WOSjqa7ehhkXh1tsKtG1OgmNO6SGo2+lgF09Z9j1JdWEmWmYQ2hsV+737sgjLfjNZ2K63xn0Y/E9lS0hRoy1w43fPvJXz+V4cNTGQoePVVgaY06ikos+tHPP616VGYNZTwIo+NpwKRXEysJxL8m5Mb/EaCA2VTwoFE3Y59luJEG/sDYeQSBnk/t4BIfT1FVuIU3nntqktu2pFauc/i1Vdwff8YprsX0VVv2/RZxD2oBm5vYLOUul5LHoeu2TGRY6J36jvHbrQ1I6iLYOjTgtadX55iRY7ZdSgMgmR+z0TPRsyGV2zqFYYNlgl8aD1dAmSc0MeeoabtaidhsUmVKELALEWg==; 5:FNwWXE8UfC1C8UwWXeiWl1MaPCiTiHADqqq4VMWbi4jGS6kFeRWvHESrVRAfCV1jq+lHjv9A8C5AFLeGNKEHN/STLyPB8oH+tEJ5U3COVEdRlBExfk+rC5xMWWIz8hvEvR8I1FqWjodnPBWBYgqJakbv2Narc3i4yxusWha7hTc=; 7:Br2vjo86G4KVQXyUzCPXb72rbaCSw2KpFOvTEWBp1P3AbbSk5OZ4SlQYeYPqkNHt1lNrdTP+BfOzisTA2276GP9O9erVuhlqnRpK719lHZoQs7Q+wjo4ImQdO5SCN6X8ByBR4rnFlXL/6tV3wpUYesfEVXORNHP9rk6Mny8bTmS3wzqHUWB2MyQxBerAT3Jm0SEvYfjyXsPROKre8CogIJCmbGuCdNRgWmXYQKHU18f4UV3IA1js90o2EPd3alvO x-ms-office365-filtering-correlation-id: f234d460-5a28-4084-cb77-08d6145aa5e6 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:CY4PR21MB0853; x-ms-traffictypediagnostic: CY4PR21MB0853: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; 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)(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:CY4PR21MB0853; BCL:0; PCL:0; RULEID:; SRVR:CY4PR21MB0853; x-forefront-prvs: 07880C4932 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(979002)(376002)(346002)(396003)(366004)(39860400002)(136003)(199004)(189003)(217873002)(105586002)(106356001)(14444005)(256004)(1076002)(66066001)(3846002)(6116002)(4326008)(25786009)(107886003)(486006)(6436002)(6512007)(6666003)(53936002)(5660300001)(68736007)(102836004)(10290500003)(186003)(2906002)(2616005)(11346002)(476003)(2501003)(5250100002)(6506007)(446003)(110136005)(8936002)(36756003)(54906003)(76176011)(99286004)(26005)(2900100001)(81166006)(7736002)(81156014)(8676002)(14454004)(305945005)(6486002)(97736004)(72206003)(478600001)(86362001)(10090500001)(316002)(22452003)(86612001)(142923001)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1102; SCL:1; SRVR:CY4PR21MB0853; 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) x-microsoft-antispam-message-info: klFsZVU1VwVf2xyUP2fe1ZpEqKb//Xfbv5yQzc5ZHBIJCo/duooYeEFYodApmWXYre3A4oPZUHLMYWcro1yKGbLCfJSmOlI5J9Pb+ig2UVDEFt+l7ZaElRfOB56TH47SCWWSJFuvac+tVaRf+dveaNfmB8rw0oCrtq6b/L8g5hlEFpHkby+k2VNmx+C8kR1MEKvECuzoVgEsX1EhZTFvWDm//mBRr+foA07DCpt6Ra1dYQfX5aWI9jeCNC+ZpLzwyMAB0heJzi3J6LWc8lccf5dwYAuE9GmEyYU6TJ/xRvkVhratu2CRHWSZrjBgihXa6FmGWYui0uXqWFhGXYZllU2uknHqPNk6Xx/kM8txgbU= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-ID: MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: f234d460-5a28-4084-cb77-08d6145aa5e6 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Sep 2018 00:39:01.5721 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR21MB0853 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 31a981d6229d..5897fc3857a0 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -359,3 +359,6 @@ endif endef # ############################################################################### + +# delete partially updated (i.e. corrupted) files on error +.DELETE_ON_ERROR: