lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Thu, 14 Jan 2021 12:19:30 +0900
From:   Namhyung Kim <namhyung@...nel.org>
To:     David Laight <David.Laight@...lab.com>
Cc:     Jiri Olsa <jolsa@...hat.com>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Ingo Molnar <mingo@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        LKML <linux-kernel@...r.kernel.org>,
        Stephane Eranian <eranian@...gle.com>,
        Ian Rogers <irogers@...gle.com>,
        Jin Yao <yao.jin@...ux.intel.com>
Subject: Re: [PATCH] perf test: Fix shadow stat test for non-bash shells

Hello,

On Tue, Jan 12, 2021 at 8:17 PM David Laight <David.Laight@...lab.com> wrote:
>
> From: Jiri Olsa
> > Sent: 12 January 2021 09:30
> >
> > On Fri, Jan 08, 2021 at 04:47:12PM +0900, Namhyung Kim wrote:
> > > It was using some bash-specific features and failed to parse when
> > > running with a different shell like below:
> ...
>
> You don't need a temporary file, one option is:
>
> > > index 249dfe48cf6a..e2c7ac4ed91d 100755
> > > --- a/tools/perf/tests/shell/stat+shadow_stat.sh
> > > +++ b/tools/perf/tests/shell/stat+shadow_stat.sh
> ...
> > >     perf stat -a -A --no-big-num -e cycles,instructions sleep 1  2>&1 | \
> > >     grep ^CPU | \
> > >     while read cpu num evt hash ipc rest
> > >     do
> ...
> > > +           if [ "$evt" = "cycles" ]; then
> > > +                   echo $cpu $num >> $results
>
>                         results="$results $cpu:$num"
>
> > >                     continue
> > >             fi
> > >
> > >             # skip if no cycles
> > > -           local cyc=${results[$cpu]}
> > > -           if [[ -z $cyc ]]; then
> > > +           local cyc=$(grep $cpu $results | cut -d' ' -f2)
>
>                 cyc=${results##* $cpu:}
>                 cyc=$(cyc%% *}
>
> > > +           if [ -z "$cyc" ]; then
> > >                     continue
> > >             fi
>
> I can't remember when 'local' was invented.
> You may find shells that don't support it.
> In any case, since this is a small standalone file I'd
> remove them just in case.

Thanks for your review, I'll make the change.

Thanks,
Namhyung

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ