From patchwork Fri May 10 16:56:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 163903 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:142:0:0:0:0 with SMTP id j2csp2625337ilr; Fri, 10 May 2019 09:56:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqzVjSBKLR7fkVmk2SmX0fQ04uLXNvtvIg370hEXAS/SqIAw0yAChnWMKDOVuOH3jRp0yN8f X-Received: by 2002:a17:902:4383:: with SMTP id j3mr14313524pld.320.1557507380120; Fri, 10 May 2019 09:56:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557507380; cv=none; d=google.com; s=arc-20160816; b=A6zEjUuFFzjRgxOBI14xpehO+waLoAP/uo/qskBOsaTsyHAM7MPRQH3SCqaK3/6LWR qkEKXYAeqiYWcdgQH4gU9PmUHpTcO755QdPu3AEpPimsJ8A1mCHaCztUE+AYQs7hgLMy spsmltVx29wqtP/hGLADRX66AK/0dBbkW2S8SPcD88LWb1VmprbsuS5s0pC645wbBHMh hZx6vcIr/5C6juat4f0nyNEa5PKzeujv7ZKT01OpDxpDxNDGTwlntfPCvhD1aTsZO4nz Kb6725p8IVthUJt9f0GmyZABs8l921ZXO89bPj11I2B/JnCCeJ4eBAoh5l9RCnO54au0 FTlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=vV6AZLFWCpm5ofhYbSPY345ZhBfp1+z8iHNyDEEWI+M=; b=qXVJzOdavFxwAwIO/Y1k9TZzzv+RFonszTTmBajYI7q5y1Xt4PFrc8iczNY503BZDg 22qMQgVr31Ci1GePOxD1L0EtOaSCrvdHCFRBq43hvni8xWpKpAIVJDYNWKpIokF7wdRq whfEB0Pe+FB2yhEnhEok/8497MQY8i7lWDs8qmybIpg4hScNIJdBL/tL3GDqayIxmalh uM1U0yqZVypS7sqH1psGUDC03/KqdDXdCEUUBi75cbjb4TWw//QbgQwu0FRJXnAkt5iH KvuF8Vwb1vcFyyZ6ztiAh/BRSQgxbqs0dMPEHBXmK85EF6kEa5oLL3g/sTqyaZYyIlAP D0tQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b="P/BIaBim"; 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 j9si8200503pgh.206.2019.05.10.09.56.19; Fri, 10 May 2019 09:56:20 -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=@nifty.com header.s=dec2015msa header.b="P/BIaBim"; 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 S1727915AbfEJQ4S (ORCPT + 30 others); Fri, 10 May 2019 12:56:18 -0400 Received: from conuserg-11.nifty.com ([210.131.2.78]:55003 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727796AbfEJQ4S (ORCPT ); Fri, 10 May 2019 12:56:18 -0400 Received: from grover.flets-west.jp (softbank126125154139.bbtec.net [126.125.154.139]) (authenticated) by conuserg-11.nifty.com with ESMTP id x4AGu96I012443; Sat, 11 May 2019 01:56:09 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com x4AGu96I012443 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1557507369; bh=vV6AZLFWCpm5ofhYbSPY345ZhBfp1+z8iHNyDEEWI+M=; h=From:To:Cc:Subject:Date:From; b=P/BIaBimtCs7VjFAcmU0akw0CAvgVKPYU3j3/Q/qGjJtqNN6lOj3FW6uasKpsI7Ta lokvICLw6gZXjPIXF6tP7pCf5Juwl5n+3JZh6PpTjjc4Sta1oyrmD682igq6Da6Xyo X0kmrcg2cQ71sp4EZB8pA6SzgEurGvPOTuM2lFIRwrtk9rYlReFqkcPLBhA1QM2jTk gxEVHRmfboWs/r+iORKk9nxnpkXEy2WbJu/tvepUVvphcK7bQVO3vcIAX0cBnVLdIh izwAt5sBCV3RECayN8xjm5TFEz6qysSv5NipN72xnHnCklPM6cv4bQ4uKLc+tqeTLk 2wqT++JW2U0Bg== X-Nifty-SrcIP: [126.125.154.139] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH] kconfig: make parent directories for the saved .config as needed Date: Sat, 11 May 2019 01:56:01 +0900 Message-Id: <1557507361-7418-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org With menuconfig / nconfig, users can input any file path from the "Save" menu, but it fails if the parent directory does not exist. Why not create the parent directory automatically. I think this is a user-friendly behavior. I changed the error messages in menuconfig / nconfig. "Nonexistent directory" is no longer the most likely reason of the failure. Perhaps, the user specified the existing directory, or attempted to write to the location without write permission. Signed-off-by: Masahiro Yamada --- scripts/kconfig/confdata.c | 3 +++ scripts/kconfig/mconf.c | 2 +- scripts/kconfig/nconf.c | 3 +-- 3 files changed, 5 insertions(+), 3 deletions(-) -- 2.7.4 diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 431b805..b7bdd96 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -881,6 +881,9 @@ int conf_write(const char *name) return -1; } + if (make_parent_dir(name)) + return -1; + env = getenv("KCONFIG_OVERWRITECONFIG"); if (env && *env) { *tmpname = 0; diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index 5f8c82a..694091f 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c @@ -936,7 +936,7 @@ static void conf_save(void) set_config_filename(dialog_input_result); return; } - show_textbox(NULL, "Can't create file! Probably a nonexistent directory.", 5, 60); + show_textbox(NULL, "Can't create file!", 5, 60); break; case 1: show_helptext("Save Alternate Configuration", save_config_help); diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c index ac92c0d..cbafe3b 100644 --- a/scripts/kconfig/nconf.c +++ b/scripts/kconfig/nconf.c @@ -1438,8 +1438,7 @@ static void conf_save(void) set_config_filename(dialog_input_result); return; } - btn_dialog(main_window, "Can't create file! " - "Probably a nonexistent directory.", + btn_dialog(main_window, "Can't create file!", 1, ""); break; case 1: