All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Raspl <raspl@linux.vnet.ibm.com>
To: kvm@vger.kernel.org
Cc: pbonzini@redhat.com, rkrcmar@redhat.com, frankja@linux.vnet.ibm.com
Subject: [PATCH 2/8] tools/kvm_stat: print error on invalid regex
Date: Mon,  5 Feb 2018 13:59:58 +0100	[thread overview]
Message-ID: <20180205130004.29691-3-raspl@linux.vnet.ibm.com> (raw)
In-Reply-To: <20180205130004.29691-1-raspl@linux.vnet.ibm.com>

From: Stefan Raspl <stefan.raspl@de.ibm.com>

Entering an invalid regular expression did not produce any indication of an
error so far.
To reproduce, press 'f' and enter 'foo(' (with an unescaped bracket).

Signed-off-by: Stefan Raspl <raspl@linux.vnet.ibm.com>
---
 tools/kvm/kvm_stat/kvm_stat | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/kvm/kvm_stat/kvm_stat b/tools/kvm/kvm_stat/kvm_stat
index 681c79a139c8..0d92c12f2b0f 100755
--- a/tools/kvm/kvm_stat/kvm_stat
+++ b/tools/kvm/kvm_stat/kvm_stat
@@ -1176,6 +1176,7 @@ class Tui(object):
         Asks for a valid regex and sets the fields filter accordingly.
 
         """
+        msg = ''
         while True:
             self.screen.erase()
             self.screen.addstr(0, 0,
@@ -1184,6 +1185,7 @@ class Tui(object):
             self.screen.addstr(2, 0,
                                "Current regex: {0}"
                                .format(self.stats.fields_filter))
+            self.screen.addstr(5, 0, msg)
             self.screen.addstr(3, 0, "New regex: ")
             curses.echo()
             regex = self.screen.getstr().decode(ENCODING)
@@ -1198,6 +1200,7 @@ class Tui(object):
                 self.refresh_header()
                 return
             except re.error:
+                msg = '"' + regex + '": Not a valid regular expression'
                 continue
 
     def show_vm_selection_by_pid(self):
-- 
2.13.5

  parent reply	other threads:[~2018-02-05 13:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-05 12:59 [PATCH 0/8] tools/kvm_stat improvements Stefan Raspl
2018-02-05 12:59 ` [PATCH 1/8] tools/kvm_stat: fix crash when filtering out all non-child trace events Stefan Raspl
2018-02-05 12:59 ` Stefan Raspl [this message]
2018-02-05 12:59 ` [PATCH 3/8] tools/kvm_stat: mark private methods as such Stefan Raspl
2018-02-13 14:48   ` Paolo Bonzini
2018-02-14 21:24     ` Stefan Raspl
2018-02-05 13:00 ` [PATCH 4/8] tools/kvm_stat: eliminate extra guest/pid selection dialog Stefan Raspl
2018-02-05 13:00 ` [PATCH 5/8] tools/kvm_stat: cache compiled regular expression Stefan Raspl
2018-02-05 13:00 ` [PATCH 6/8] tools/kvm_stat: separate drilldown and fields filtering Stefan Raspl
2018-02-13 14:55   ` Paolo Bonzini
2018-02-14 21:31     ` Stefan Raspl
2018-02-05 13:00 ` [PATCH 7/8] tools/kvm_stat: group child events indented after parent Stefan Raspl
2018-02-05 13:00 ` [PATCH 8/8] tools/kvm_stat: print 'Total' line for multiple events only Stefan Raspl
2018-02-13 14:56 ` [PATCH 0/8] tools/kvm_stat improvements Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180205130004.29691-3-raspl@linux.vnet.ibm.com \
    --to=raspl@linux.vnet.ibm.com \
    --cc=frankja@linux.vnet.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.