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:	Mon, 26 Sep 2011 20:30:13 -0700
From:	Darren Hart <dvhart@...ux.intel.com>
To:	Darren Hart <dvhart@...ux.intel.com>
CC:	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	John Stultz <johnstul@...ibm.com>,
	Dmitry Fink <Dmitry.Fink@...m.com>
Subject: Re: [PATCH 1/2] merge_config.sh: do not print non-matching lines
 in the sed expressions

On 09/26/2011 08:25 PM, Darren Hart wrote:
> The script picks up on comment lines and run into failed grep commands and
> spew lots of warnings about "#" not being set and so forth.
> 
> sed will print non-matching lines without the -n option. Add -n and a p (print)
> to each sed command. This will ensure only the CONFIG_* lines are used for
> value comparison, and comment lines are ignored. # CONFIG_XYZ is not set are
> still matched and not treated as comments. This addresses an issue Dmitry raised
> without another pipe and call to grep.
> 
> Move the sed expression into a variable to avoid getting the regular expressions
> in the two call sites out of sync.
> 
> Signed-off-by: Darren Hart <dvhart@...ux.intel.com>
> CC: Dmitry Fink <Dmitry.Fink@...m.com>
> ---
>  scripts/kconfig/merge_config.sh |   10 ++++------
>  1 files changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/scripts/kconfig/merge_config.sh b/scripts/kconfig/merge_config.sh
> index fda0139..a644724 100755
> --- a/scripts/kconfig/merge_config.sh
> +++ b/scripts/kconfig/merge_config.sh
> @@ -25,11 +25,12 @@ MERGE_LIST=$*
>  
>  TMP_FILE=$(mktemp ./.tmp.config.XXXXXXXXXX)
>  
> +SED_CONFIG_EXP="s/^\(# \)\{0,1\}\(CONFIG_[a-zA-Z0-9_]*\)[= ].*/\2/p"
> +
>  # Merge files, printing warnings on overrided values
>  for MERGE_FILE in $MERGE_LIST ; do
>  	echo "Merging $MERGE_FILE"
> -	CFG_LIST=`cat $MERGE_FILE | \
> -	  sed 's/^\(# \)\{0,1\}\(CONFIG_[a-zA-Z0-9_]*\)[= ].*/\2/'`
> +	CFG_LIST=`cat $MERGE_FILE | sed -n "$SED_CONFIG_EXP"`

Gah, and this doesn't need the cat either:

        CFG_LIST=`sed -n "$SED_CONFIG_EXP" $MERGE_FILE`

--
Darren

>  	for CFG in $CFG_LIST ; do
>  		grep -q -w $CFG $TMP_FILE
>  		if [ $? == 0 ] ; then
> @@ -53,10 +54,7 @@ done
>  make KCONFIG_ALLCONFIG=$TMP_FILE alldefconfig
>  
>  # Check all specified config values took (might have missed-dependency issues)
> -cat $TMP_FILE | while read line; do
> -	CFG=`echo $line | \
> -		sed 's/^\(# \)\{0,1\}\(CONFIG_[a-zA-Z0-9_]*\)[= ].*/\2/'`
> -
> +for CFG in `sed -n "$SED_CONFIG_EXP" $TMP_FILE`; do
>  	REQUESTED_VAL=`grep -w -e "$CFG" $TMP_FILE`
>  	ACTUAL_VAL=`grep -w -e "$CFG" .config`
>  	if [ "x$REQUESTED_VAL" != "x$ACTUAL_VAL" ] ; then

-- 
Darren Hart
Intel Open Source Technology Center
Yocto Project - Linux Kernel
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ