Re: [PATCH 1/1] gpio: add sloppy logic analyzer using polling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Sep 6, 2021 at 12:04 PM Wolfram Sang
<wsa+renesas@xxxxxxxxxxxxxxxxxxxx> wrote:

...

> > > +#!/bin/sh -eu
> >
> > Next step is to add 'f' to the mix here :-)
>
> -f broke zip file generation in a way I didn't know how to resolve
> differently. Sadly, I can't recall the details right now.

Yes, it means you are not able to use * (a.k.a. glob() function) in
the shell which increases a lot security and other (misuse) concerns.
Instead you have to use `find` or similar tools to collect the list of
the files of your interest.

...

> > > +while true; do
> > > +       case "$1" in
> > > +       -c|--cpu) initcpu="$2"; shift 2;;
> > > +       -d|--duration-us) duration="$2"; shift 2;;
> > > +       -h|--help) print_help; exit 0;;
> > > +       -i|--instance) lasysfsdir="$sysfsdir/$2"; shift 2;;
> > > +       -k|--kernel-debug-dir) debugdir="$2"; shift 2;;
> > > +       -n|--num_samples) numsamples="$2"; shift 2;;
> > > +       -o|--output-dir) outputdir="$2"; shift 2;;
> > > +       -s|--sample_freq) samplefreq="$2"; shift 2;;
> > > +       -t|--trigger) triggerdat="$2"; shift 2;;
> > > +       --)     shift; break;;
> > > +       *)      fail "error parsing commandline: $*";;
> > > +       esac
> >
> > I would prefer to have a clear shift here instead of doing shift 2
> > everywhere above (less error prone).
>
> If we ever support binary arguments (toggles), then a generic 'shift 2'
> won't work?

To me it's less error prone to have something like this:

while [ $# -gt 1 ]; do # notice the condition, btw
  case "$1" in
  opt_with_parameter) ...; shift;;
  toggler_opt) ...;;
  esac
  shift
done

> > > +done

Either way it's minor.

-- 
With Best Regards,
Andy Shevchenko



[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux