Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2521350imm; Mon, 24 Sep 2018 05:52:41 -0700 (PDT) X-Google-Smtp-Source: ACcGV607ENAdyXmHBrsGtTlrgaIKA84J0ijzb1lWJ20dl6hr1as992/mo0X1hWP9vwkCgYCis9y0 X-Received: by 2002:a63:66c3:: with SMTP id a186-v6mr9501539pgc.330.1537793561188; Mon, 24 Sep 2018 05:52:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537793561; cv=none; d=google.com; s=arc-20160816; b=h1c8uggfCHnTTRONc+6069LTd6emPRRmicBU5vBaE2TFu2RVrjCBAZeydhTF8OCukv O9ML3lx2vnxaHap72Fl5zDdHkg8u2CW11qBCt15IHOyfyT5c+Azl1KjGrs7HICCCpnkO RHfLcRNd6YR7lFTZDJ1GwumYwGc/10ET5LGVYKYHIcgkhxdAoXeNk+/0GBJXNxz9c2u6 0WcpzB1hAVb8BHsUoy77UPWZSTNfKpsyg0ObYgyXblC/2fmgV4NB0iuO6okNocCjgY5U 5+yJvQcSJo1uHQ57geCQbexv9n6Qlzm55oA3yY9Yn8M5cz6sUmVG9U5A5yPPAdf+B+2r ptWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=/kdVvUUzEZn2z6CAUeYZI/3nD6yKepsHDMkv3D2AmNc=; b=SYdnDWt8xadLMSq5ZBH12dUPEqgJkCaErRLQGBtoRPOHWNUwvqTLK2qShMoCUhPCky FMXuSnpWPrE7UauVNiiRae394kG5MdYjhUn4w93GJj84xTiDVMMCqNvhUMt/oJxkX7RZ iQ2sQ0mZBq5iLd9pfM8n/HQFUD4l8ihY1PaE5GHrSYvB7FcnCPMmI6GFz/AjxpAIjx3A p3i1Qtjw12Ns56tWrcle/YoMqWD5i3hWg5jAgt+N+1zYredTUdMujUh7JOoge97cFjn7 2S8pG9Mt/HM5PgxmttY9O5j4Z0176+nIYhn1pNqxPQrl4XkQFlJLxzYG/5hZQuRE52h6 1fVQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v3-v6si34567258plp.85.2018.09.24.05.52.26; Mon, 24 Sep 2018 05:52:41 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387574AbeIXSad (ORCPT + 99 others); Mon, 24 Sep 2018 14:30:33 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:57472 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732882AbeIXSac (ORCPT ); Mon, 24 Sep 2018 14:30:32 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 9D4821018; Mon, 24 Sep 2018 12:28:37 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Masahiro Yamada , Sasha Levin Subject: [PATCH 4.18 034/235] kbuild: add .DELETE_ON_ERROR special target Date: Mon, 24 Sep 2018 13:50:20 +0200 Message-Id: <20180924113108.383426053@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180924113103.999624566@linuxfoundation.org> References: <20180924113103.999624566@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ 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 Signed-off-by: Greg Kroah-Hartman --- scripts/Kbuild.include | 3 +++ 1 file changed, 3 insertions(+) --- 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: