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: <ZY3HYWBFsiQ9x_Ox@d3>
Date: Thu, 28 Dec 2023 14:07:13 -0500
From: Benjamin Poirier <bpoirier@...dia.com>
To: Vladimir Oltean <vladimir.oltean@....com>
Cc: netdev@...r.kernel.org, Shuah Khan <shuah@...nel.org>,
	Petr Machata <petrm@...dia.com>, Hangbin Liu <liuhangbin@...il.com>
Subject: Re: [RFC PATCH net-next 04/10] selftests: forwarding: Simplify
 forwarding.config import logic

On 2023-12-27 21:27 +0200, Vladimir Oltean wrote:
> On Fri, Dec 22, 2023 at 08:58:30AM -0500, Benjamin Poirier wrote:
> > The first condition removed by this patch reimplements functionality that
> > is part of `dirname`:
> > $ dirname ""
> > .
> > 
> > Use the libdir variable introduced in the previous patch to import
> > forwarding.config without duplicating functionality.
> > 
> > Signed-off-by: Benjamin Poirier <bpoirier@...dia.com>
> > ---
> >  tools/testing/selftests/net/forwarding/lib.sh | 14 +++++---------
> >  1 file changed, 5 insertions(+), 9 deletions(-)
> > 
> > diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh
> > index f9e32152f23d..481d9b655a40 100644
> > --- a/tools/testing/selftests/net/forwarding/lib.sh
> > +++ b/tools/testing/selftests/net/forwarding/lib.sh
> > @@ -29,16 +29,12 @@ STABLE_MAC_ADDRS=${STABLE_MAC_ADDRS:=no}
> >  TCPDUMP_EXTRA_FLAGS=${TCPDUMP_EXTRA_FLAGS:=}
> >  TROUTE6=${TROUTE6:=traceroute6}
> >  
> > -relative_path="${BASH_SOURCE%/*}"
> > -if [[ "$relative_path" == "${BASH_SOURCE}" ]]; then
> > -	relative_path="."
> > -fi
> > -
> > -if [[ -f $relative_path/forwarding.config ]]; then
> > -	source "$relative_path/forwarding.config"
> > -fi
> > -
> >  libdir=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
> > +
> > +if [ -f "$libdir"/forwarding.config ]; then
> > +       source "$libdir"/forwarding.config
> 
> Nitpick: this used to be indented with tabs, not spaces.

Thank you for pointing it out. I have fixed it.

> Also, any
> reason why only "$libdir" is quoted and not the full path, as before?

It's not necessary to quote "/forwarding.config" since it doesn't expand
or split, so I did not quote it. Also, the previous code was
inconsistent in its quoting.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ