Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1571599

[tip:perf/core] perf config: Do not consider an error not to have any perfconfig file

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From tip-bot for Arnaldo Carvalho de Melo <tipbot@zytor.com>
Newsgroups linux.kernel
Subject [tip:perf/core] perf config: Do not consider an error not to have any perfconfig file
Date Wed, 01 Feb 2017 15:40:02 +0100
Message-ID <t64eK-77f-27@gated-at.bofh.it> (permalink)
X-Original-To linux-tip-commits@vger.kernel.org
Reply-To adrian.hunter@intel.com, treeze.taeung@gmail.com, mingo@kernel.org, tglx@linutronix.de, wangnan0@huawei.com, hpa@zytor.com, dsahern@gmail.com, jolsa@kernel.org, acme@redhat.com, namhyung@kernel.org, linux-kernel@vger.kernel.org
Git-Commit-ID afc45cf52c93009f1f4432e50365ce294ba7a474
X-Mailer tip-git-log-daemon
Robot-ID <tip-bot.git.kernel.org>
Robot-Unsubscribe Contact <mailto:hpa@kernel.org> to get blacklisted from these emails
MIME-Version 1.0
Content-Transfer-Encoding 8bit
Content-Type text/plain; charset=UTF-8
Content-Disposition inline
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 64
Organization linux.* mail to news gateway
X-Original-Cc linux-kernel@vger.kernel.org, namhyung@kernel.org, acme@redhat.com, jolsa@kernel.org, dsahern@gmail.com, hpa@zytor.com, wangnan0@huawei.com, tglx@linutronix.de, adrian.hunter@intel.com, treeze.taeung@gmail.com, mingo@kernel.org
X-Original-Date Wed, 1 Feb 2017 06:38:11 -0800
X-Original-Message-ID <tip-ygpbab3apbs6l8wr97xedwks@git.kernel.org>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1571599

Show key headers only | View raw


Commit-ID:  afc45cf52c93009f1f4432e50365ce294ba7a474
Gitweb:     http://git.kernel.org/tip/afc45cf52c93009f1f4432e50365ce294ba7a474
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Fri, 27 Jan 2017 10:21:01 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 27 Jan 2017 10:28:34 -0300

perf config: Do not consider an error not to have any perfconfig file

While propagating the errors from perf_config(), which were being
completely ignored, everything stopped working for people without a
~/.perfconfig file, because the perf_config_set__init() was considering
an error not to have a .perfconfig file, duh, fix it by checking the
errno after the failed stat() call.

It should also not return an error when it says it is ignoring the file,
and also a empty file should not return an error either.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Taeung Song <treeze.taeung@gmail.com>
Cc: Wang Nan <wangnan0@huawei.com>
Fixes: 8beeb00f2c84 ("perf config: Use new perf_config_set__init() to initialize config set")
Link: http://lkml.kernel.org/n/tip-ygpbab3apbs6l8wr97xedwks@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/config.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/tools/perf/util/config.c b/tools/perf/util/config.c
index 3d906db..615e8b4 100644
--- a/tools/perf/util/config.c
+++ b/tools/perf/util/config.c
@@ -646,8 +646,13 @@ static int perf_config_set__init(struct perf_config_set *set)
 			goto out;
 		}
 
-		if (stat(user_config, &st) < 0)
+		if (stat(user_config, &st) < 0) {
+			if (errno == ENOENT)
+				ret = 0;
 			goto out_free;
+		}
+
+		ret = 0;
 
 		if (st.st_uid && (st.st_uid != geteuid())) {
 			warning("File %s not owned by current user or root, "
@@ -655,11 +660,8 @@ static int perf_config_set__init(struct perf_config_set *set)
 			goto out_free;
 		}
 
-		if (!st.st_size)
-			goto out_free;
-
-		ret = perf_config_from_file(collect_config, user_config, set);
-
+		if (st.st_size)
+			ret = perf_config_from_file(collect_config, user_config, set);
 out_free:
 		free(user_config);
 	}

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[tip:perf/core] perf config: Do not consider an error not to have  any perfconfig file tip-bot for Arnaldo Carvalho de Melo <tipbot@zytor.com> - 2017-02-01 15:40 +0100

csiph-web