linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tools/perf: fix use of alternatives to find JDIR
@ 2018-09-06 22:18 Jarod Wilson
  2018-09-10  8:05 ` Jiri Olsa
  2018-10-18  6:18 ` [tip:perf/urgent] perf tools: Fix " tip-bot for Jarod Wilson
  0 siblings, 2 replies; 5+ messages in thread
From: Jarod Wilson @ 2018-09-06 22:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jarod Wilson, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Alexander Shishkin, Jiri Olsa,
	Namhyung Kim

When a build is run from something like a cron job, the user's $PATH is
rather minimal, of note, not including /usr/sbin in my own case. Because
of that, an automated rpm package build ultimately fails to find
libperf-jvmti.so, because somewhere within the build, this happens...

/bin/sh: alternatives: command not found
/bin/sh: alternatives: command not found
Makefile.config:849: No openjdk development package found, please install
JDK package, e.g. openjdk-8-jdk, java-1.8.0-openjdk-devel

...and while the build continues, libperf-jvmti.so isn't built, and things
fall down when rpm tries to find all the %files specified. Exact same
system builds everything just fine when the job is launched from a login
shell instead of a cron job, since alternatives is in $PATH, so openjdk is
actually found.

The test required to get into this section of code actually specifies the
full path, as does a block just above it, so let's do that here too.

CC: Peter Zijlstra <peterz@infradead.org>
CC: Ingo Molnar <mingo@redhat.com>
CC: Arnaldo Carvalho de Melo <acme@kernel.org>
CC: Alexander Shishkin <alexander.shishkin@linux.intel.com>
CC: Jiri Olsa <jolsa@redhat.com>
CC: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Jarod Wilson <jarod@redhat.com>
---
 tools/perf/Makefile.config | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index f6d1a03c7523..e30d20fb482d 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -833,7 +833,7 @@ ifndef NO_JVMTI
     JDIR=$(shell /usr/sbin/update-java-alternatives -l | head -1 | awk '{print $$3}')
   else
     ifneq (,$(wildcard /usr/sbin/alternatives))
-      JDIR=$(shell alternatives --display java | tail -1 | cut -d' ' -f 5 | sed 's%/jre/bin/java.%%g')
+      JDIR=$(shell /usr/sbin/alternatives --display java | tail -1 | cut -d' ' -f 5 | sed 's%/jre/bin/java.%%g')
     endif
   endif
   ifndef JDIR
-- 
2.16.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] tools/perf: fix use of alternatives to find JDIR
  2018-09-06 22:18 [PATCH] tools/perf: fix use of alternatives to find JDIR Jarod Wilson
@ 2018-09-10  8:05 ` Jiri Olsa
  2018-10-16 13:09   ` Jiri Olsa
  2018-10-18  6:18 ` [tip:perf/urgent] perf tools: Fix " tip-bot for Jarod Wilson
  1 sibling, 1 reply; 5+ messages in thread
From: Jiri Olsa @ 2018-09-10  8:05 UTC (permalink / raw)
  To: Jarod Wilson
  Cc: linux-kernel, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Alexander Shishkin, Namhyung Kim

On Thu, Sep 06, 2018 at 06:18:12PM -0400, Jarod Wilson wrote:
> When a build is run from something like a cron job, the user's $PATH is
> rather minimal, of note, not including /usr/sbin in my own case. Because
> of that, an automated rpm package build ultimately fails to find
> libperf-jvmti.so, because somewhere within the build, this happens...
> 
> /bin/sh: alternatives: command not found
> /bin/sh: alternatives: command not found
> Makefile.config:849: No openjdk development package found, please install
> JDK package, e.g. openjdk-8-jdk, java-1.8.0-openjdk-devel
> 
> ...and while the build continues, libperf-jvmti.so isn't built, and things
> fall down when rpm tries to find all the %files specified. Exact same
> system builds everything just fine when the job is launched from a login
> shell instead of a cron job, since alternatives is in $PATH, so openjdk is
> actually found.
> 
> The test required to get into this section of code actually specifies the
> full path, as does a block just above it, so let's do that here too.
> 
> CC: Peter Zijlstra <peterz@infradead.org>
> CC: Ingo Molnar <mingo@redhat.com>
> CC: Arnaldo Carvalho de Melo <acme@kernel.org>
> CC: Alexander Shishkin <alexander.shishkin@linux.intel.com>
> CC: Jiri Olsa <jolsa@redhat.com>
> CC: Namhyung Kim <namhyung@kernel.org>
> Signed-off-by: Jarod Wilson <jarod@redhat.com>

Acked-by: Jiri Olsa <jolsa@redhat.com>

thanks,
jirka

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] tools/perf: fix use of alternatives to find JDIR
  2018-09-10  8:05 ` Jiri Olsa
@ 2018-10-16 13:09   ` Jiri Olsa
  2018-10-16 15:04     ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 5+ messages in thread
From: Jiri Olsa @ 2018-10-16 13:09 UTC (permalink / raw)
  To: Jarod Wilson, Arnaldo Carvalho de Melo
  Cc: linux-kernel, Peter Zijlstra, Ingo Molnar, Alexander Shishkin,
	Namhyung Kim

On Mon, Sep 10, 2018 at 10:05:46AM +0200, Jiri Olsa wrote:
> On Thu, Sep 06, 2018 at 06:18:12PM -0400, Jarod Wilson wrote:
> > When a build is run from something like a cron job, the user's $PATH is
> > rather minimal, of note, not including /usr/sbin in my own case. Because
> > of that, an automated rpm package build ultimately fails to find
> > libperf-jvmti.so, because somewhere within the build, this happens...
> > 
> > /bin/sh: alternatives: command not found
> > /bin/sh: alternatives: command not found
> > Makefile.config:849: No openjdk development package found, please install
> > JDK package, e.g. openjdk-8-jdk, java-1.8.0-openjdk-devel
> > 
> > ...and while the build continues, libperf-jvmti.so isn't built, and things
> > fall down when rpm tries to find all the %files specified. Exact same
> > system builds everything just fine when the job is launched from a login
> > shell instead of a cron job, since alternatives is in $PATH, so openjdk is
> > actually found.
> > 
> > The test required to get into this section of code actually specifies the
> > full path, as does a block just above it, so let's do that here too.
> > 
> > CC: Peter Zijlstra <peterz@infradead.org>
> > CC: Ingo Molnar <mingo@redhat.com>
> > CC: Arnaldo Carvalho de Melo <acme@kernel.org>
> > CC: Alexander Shishkin <alexander.shishkin@linux.intel.com>
> > CC: Jiri Olsa <jolsa@redhat.com>
> > CC: Namhyung Kim <namhyung@kernel.org>
> > Signed-off-by: Jarod Wilson <jarod@redhat.com>
> 
> Acked-by: Jiri Olsa <jolsa@redhat.com>

Arnaldo,
could you please pull in this one?

thanks,
jirka

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] tools/perf: fix use of alternatives to find JDIR
  2018-10-16 13:09   ` Jiri Olsa
@ 2018-10-16 15:04     ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2018-10-16 15:04 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Jarod Wilson, linux-kernel, Peter Zijlstra, Ingo Molnar,
	Alexander Shishkin, Namhyung Kim

Em Tue, Oct 16, 2018 at 03:09:59PM +0200, Jiri Olsa escreveu:
> On Mon, Sep 10, 2018 at 10:05:46AM +0200, Jiri Olsa wrote:
> > On Thu, Sep 06, 2018 at 06:18:12PM -0400, Jarod Wilson wrote:
> > > When a build is run from something like a cron job, the user's $PATH is
> > > rather minimal, of note, not including /usr/sbin in my own case. Because
> > > of that, an automated rpm package build ultimately fails to find
> > > libperf-jvmti.so, because somewhere within the build, this happens...
> > > 
> > > /bin/sh: alternatives: command not found
> > > /bin/sh: alternatives: command not found
> > > Makefile.config:849: No openjdk development package found, please install
> > > JDK package, e.g. openjdk-8-jdk, java-1.8.0-openjdk-devel
> > > 
> > > ...and while the build continues, libperf-jvmti.so isn't built, and things
> > > fall down when rpm tries to find all the %files specified. Exact same
> > > system builds everything just fine when the job is launched from a login
> > > shell instead of a cron job, since alternatives is in $PATH, so openjdk is
> > > actually found.
> > > 
> > > The test required to get into this section of code actually specifies the
> > > full path, as does a block just above it, so let's do that here too.
> > > 
> > > CC: Peter Zijlstra <peterz@infradead.org>
> > > CC: Ingo Molnar <mingo@redhat.com>
> > > CC: Arnaldo Carvalho de Melo <acme@kernel.org>
> > > CC: Alexander Shishkin <alexander.shishkin@linux.intel.com>
> > > CC: Jiri Olsa <jolsa@redhat.com>
> > > CC: Namhyung Kim <namhyung@kernel.org>
> > > Signed-off-by: Jarod Wilson <jarod@redhat.com>
> > 
> > Acked-by: Jiri Olsa <jolsa@redhat.com>
> 
> Arnaldo,
> could you please pull in this one?

Sure, I thought I had already, will now.

- Arnaldo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [tip:perf/urgent] perf tools: Fix use of alternatives to find JDIR
  2018-09-06 22:18 [PATCH] tools/perf: fix use of alternatives to find JDIR Jarod Wilson
  2018-09-10  8:05 ` Jiri Olsa
@ 2018-10-18  6:18 ` tip-bot for Jarod Wilson
  1 sibling, 0 replies; 5+ messages in thread
From: tip-bot for Jarod Wilson @ 2018-10-18  6:18 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: alexander.shishkin, peterz, linux-kernel, wcohen, namhyung,
	mingo, eranian, jarod, hpa, tglx, acme, jolsa

Commit-ID:  36b8d4628d3cc8f5a748e508cce8673bc00fc63c
Gitweb:     https://git.kernel.org/tip/36b8d4628d3cc8f5a748e508cce8673bc00fc63c
Author:     Jarod Wilson <jarod@redhat.com>
AuthorDate: Thu, 6 Sep 2018 18:18:12 -0400
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 16 Oct 2018 12:06:47 -0300

perf tools: Fix use of alternatives to find JDIR

When a build is run from something like a cron job, the user's $PATH is
rather minimal, of note, not including /usr/sbin in my own case. Because
of that, an automated rpm package build ultimately fails to find
libperf-jvmti.so, because somewhere within the build, this happens...

  /bin/sh: alternatives: command not found
  /bin/sh: alternatives: command not found
  Makefile.config:849: No openjdk development package found, please install
  JDK package, e.g. openjdk-8-jdk, java-1.8.0-openjdk-devel

...and while the build continues, libperf-jvmti.so isn't built, and
things fall down when rpm tries to find all the %files specified. Exact
same system builds everything just fine when the job is launched from a
login shell instead of a cron job, since alternatives is in $PATH, so
openjdk is actually found.

The test required to get into this section of code actually specifies
the full path, as does a block just above it, so let's do that here too.

Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: William Cohen <wcohen@redhat.com>
Fixes: d4dfdf00d43e ("perf jvmti: Plug compilation into perf build")
Link: http://lkml.kernel.org/r/20180906221812.11167-1-jarod@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Makefile.config | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index f6d1a03c7523..e30d20fb482d 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -833,7 +833,7 @@ ifndef NO_JVMTI
     JDIR=$(shell /usr/sbin/update-java-alternatives -l | head -1 | awk '{print $$3}')
   else
     ifneq (,$(wildcard /usr/sbin/alternatives))
-      JDIR=$(shell alternatives --display java | tail -1 | cut -d' ' -f 5 | sed 's%/jre/bin/java.%%g')
+      JDIR=$(shell /usr/sbin/alternatives --display java | tail -1 | cut -d' ' -f 5 | sed 's%/jre/bin/java.%%g')
     endif
   endif
   ifndef JDIR

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-10-18  6:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-06 22:18 [PATCH] tools/perf: fix use of alternatives to find JDIR Jarod Wilson
2018-09-10  8:05 ` Jiri Olsa
2018-10-16 13:09   ` Jiri Olsa
2018-10-16 15:04     ` Arnaldo Carvalho de Melo
2018-10-18  6:18 ` [tip:perf/urgent] perf tools: Fix " tip-bot for Jarod Wilson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).