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] [thread-next>] [day] [month] [year] [list]
Message-ID: <YV1xLsQsADEhrJPz@renaissance-vector>
Date:   Wed, 6 Oct 2021 11:49:34 +0200
From:   Andrea Claudi <aclaudi@...hat.com>
To:     Phil Sutter <phil@....cc>, netdev@...r.kernel.org,
        stephen@...workplumber.org, dsahern@...il.com, bluca@...ian.org
Subject: Re: [PATCH iproute2 v3 1/3] configure: support --param=value style

On Wed, Oct 06, 2021 at 10:09:44AM +0200, Phil Sutter wrote:
> Hi Andrea,
> 
> A remark regarding coding style:
> 

Hi Phil,
Thanks for your review.

> On Wed, Oct 06, 2021 at 12:08:04AM +0200, Andrea Claudi wrote:
> [...]
> > diff --git a/configure b/configure
> > index 7f4f3bd9..d57ce0f8 100755
> > --- a/configure
> > +++ b/configure
> > @@ -501,18 +501,30 @@ if [ $# -eq 1 ] && [ "$(echo $1 | cut -c 1)" != '-' ]; then
> >  else
> >  	while true; do
> >  		case "$1" in
> > -			--include_dir)
> > -				INCLUDE=$2
> > -				shift 2 ;;
> > -			--libbpf_dir)
> > -				LIBBPF_DIR="$2"
> > -				shift 2 ;;
> > -			--libbpf_force)
> > -				if [ "$2" != 'on' ] && [ "$2" != 'off' ]; then
> > +			--include_dir | --include_dir=*)
> 
> So here the code combines the two cases,
> 
> > +				INCLUDE="${1#*=}"
> > +				if [ "$INCLUDE" == "--include_dir" ]; then
> 
> just to fiddle it apart again. Did you consider leaving the old cases in
> place and adding separate ones for the --opt=val cases like so:
> 
> | 			--include_dir=*)
> | 				INCLUDE="${1#*=}"
> | 				shift
> | 				;;
> 
> [...]

That was my first proposal in v1 [1]. I changed it on David's suggestion
to consolidate the two cases into a single one.

Looking at the resulting code, v3 code results in an extra check to
discriminate between the two use cases, while v0 uses the "case"
structure to the same end.

> > +			--libbpf_force | --libbpf_force=*)
> > +				LIBBPF_FORCE="${1#*=}"
> > +				if [ "$LIBBPF_FORCE" == "--libbpf_force" ]; then
> > +					LIBBPF_FORCE="$2"
> > +					shift
> > +				fi
> > +				if [ "$LIBBPF_FORCE" != 'on' ] && [ "$LIBBPF_FORCE" != 'off' ]; then
> 
> To avoid duplication here, I would move semantic checks into a second
> step. This would allow for things like:
> 
> | --libbpf_force=invalid --libbpf_force=on
> 
> but separating the syntactic parsing from semantic checks might be
> beneficial by itself, too.

Yes, I agree with you. David, does this answer to your concern about v1?
If yes, I would proceed with a v4 integrating Phil's suggestions.

> 
> Cheers, Phil
>

[1] https://lore.kernel.org/netdev/cover.1633191885.git.aclaudi@redhat.com/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ