linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kernel-shark: kernel-shark: Avoid a duplicate error message from capture
@ 2019-07-10 15:39 Yordan Karadzhov (VMware)
       [not found] ` <CAE858AmPCXOTqx+80ukPMG3ovSTeoiMWSesMKR6iFVBQ+jkw_Q@mail.gmail.com>
  0 siblings, 1 reply; 2+ messages in thread
From: Yordan Karadzhov (VMware) @ 2019-07-10 15:39 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel, Yordan Karadzhov (VMware)

If the capture process finishes with an error the _captureError() slot
will print an error message. We do not need to print identical message
in _captureFinished().

However, we have to keep in mind that the process that we started is
"pkexec" and the capture dialog is a child process of "pkexec". So if
the capture dialog failed to start or crashed the "pkexec" process
itself will have a normal exit, however its return value will be
different from 0 (it will just pass the return value of the capture
dialog executable). In this case _captureError() is not triggered,
but we still want to see an error message.

Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
 kernel-shark/src/KsMainWindow.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel-shark/src/KsMainWindow.cpp b/kernel-shark/src/KsMainWindow.cpp
index 29d44d9..c127ad1 100644
--- a/kernel-shark/src/KsMainWindow.cpp
+++ b/kernel-shark/src/KsMainWindow.cpp
@@ -1180,7 +1180,7 @@ void KsMainWindow::_captureFinished(int ret, QProcess::ExitStatus st)
 		return;
 	}
 
-	if (ret != 0 || st != QProcess::NormalExit) {
+	if (ret != 0 || st == QProcess::NormalExit) {
 		QString message = "Capture process failed:<br>";
 
 		message += capture->errorString();
-- 
2.20.1


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

* Re: [PATCH] kernel-shark: kernel-shark: Avoid a duplicate error message from capture
       [not found] ` <CAE858AmPCXOTqx+80ukPMG3ovSTeoiMWSesMKR6iFVBQ+jkw_Q@mail.gmail.com>
@ 2019-07-10 16:31   ` Steven Rostedt
  0 siblings, 0 replies; 2+ messages in thread
From: Steven Rostedt @ 2019-07-10 16:31 UTC (permalink / raw)
  To: Yordan Karadzhov; +Cc: Linux Trace Devel

On Wed, 10 Jul 2019 19:00:43 +0300
Yordan Karadzhov <y.karadz@gmail.com> wrote:

> On Wed, Jul 10, 2019, 18:39 Yordan Karadzhov (VMware) <y.karadz@gmail.com>
> wrote:
> 
> > If the capture process finishes with an error the _captureError() slot
> > will print an error message. We do not need to print identical message
> > in _captureFinished().
> >
> > However, we have to keep in mind that the process that we started is
> > "pkexec" and the capture dialog is a child process of "pkexec". So if
> > the capture dialog failed to start or crashed the "pkexec" process
> > itself will have a normal exit, however its return value will be
> > different from 0 (it will just pass the return value of the capture
> > dialog executable). In this case _captureError() is not triggered,
> > but we still want to see an error message.
> >
> > Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
> > ---
> >  kernel-shark/src/KsMainWindow.cpp | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/kernel-shark/src/KsMainWindow.cpp
> > b/kernel-shark/src/KsMainWindow.cpp
> > index 29d44d9..c127ad1 100644
> > --- a/kernel-shark/src/KsMainWindow.cpp
> > +++ b/kernel-shark/src/KsMainWindow.cpp
> > @@ -1180,7 +1180,7 @@ void KsMainWindow::_captureFinished(int ret,
> > QProcess::ExitStatus st)
> >                 return;
> >         }
> >
> > -       if (ret != 0 || st != QProcess::NormalExit) {
> > +       if (ret != 0 || st == QProcess::NormalExit) {
> >
> 
> Ohh, I made stupid mistake in the rush. Must use AND instead of OR

Heh, want me to just make the fix, or can you send a v2?

-- Steve

> 
>                 QString message = "Capture process failed:<br>";
> >
> >                 message += capture->errorString();
> > --
> > 2.20.1
> >
> >


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

end of thread, other threads:[~2019-07-10 16:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-10 15:39 [PATCH] kernel-shark: kernel-shark: Avoid a duplicate error message from capture Yordan Karadzhov (VMware)
     [not found] ` <CAE858AmPCXOTqx+80ukPMG3ovSTeoiMWSesMKR6iFVBQ+jkw_Q@mail.gmail.com>
2019-07-10 16:31   ` Steven Rostedt

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).