On 02/09/14 at 07:41pm, Pierre Neidhardt wrote:
If input cannot be parsed, it is not desirable to output it along other valid entries. This would make pacsearch output unpredictable.
Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com> --- contrib/pacsearch.in | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
-1. pacsearch is a thin pacman wrapper and should not hide output. Since it doesn't do any real argument parsing, a user can pass an option that alters pacman's output (-q for instance) and this would hide all output from the user without giving any indication of an error.
diff --git a/contrib/pacsearch.in b/contrib/pacsearch.in index 0ab840e..df0d62d 100644 --- a/contrib/pacsearch.in +++ b/contrib/pacsearch.in @@ -111,11 +111,8 @@ foreach $_ (@syncpkgs) { # desc. We grab leading space for 'group' and 'installed' so that we do not # need to test if non-empty when printing. my @pkgfields = /^(.*?)\/(.*?) (.*?)( \(.*?\))?( \[.*\])?\n(.*)$/s; - if(not @pkgfields) { - # skip any non-matching line and just print it for the user - print $_, "\n"; - next; - } + # skip any non-matching line + next if not defined $pkgfields[1]; # since 'group' and 'installed' are optional, we should fill it in if necessary $pkgfields[3] = "" if not defined $pkgfields[3]; $pkgfields[4] = "" if not defined $pkgfields[4]; -- 1.8.5.4