Re: [PATCH v2] kconfig: merge_config: avoid false positive matches from comment lines

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

 



> The current SED_CONFIG_EXP could match to comment lines in config
> fragment files, especially when CONFIG_PREFIX_ is empty. For example,
> Buildroot uses empty prefixing; starting symbols with BR2_ is just
> convention.

> Make the sed expression more robust against false positives from
> comment lines. The new sed expression matches to only valid patterns.

> Signed-off-by: Masahiro Yamada <yamada.masahiro@xxxxxxxxxxxxx>
> Reviewed-by: Petr Vorel <petr.vorel@xxxxxxxxx>
> ---
Reviewed-by: Petr Vorel <petr.vorel@xxxxxxxxx>

> Changes in v2:
>   - Another (more precise) implementation approach
>     based on the option from Arnout Vandecappelle.
>     This is still easier to read, but adds a bit duplication.

>  scripts/kconfig/merge_config.sh | 7 ++++---
...
> -SED_CONFIG_EXP="s/^\(# \)\{0,1\}\(${CONFIG_PREFIX}[a-zA-Z0-9_]*\)[= ].*/\2/p"
> +SED_CONFIG_EXP1="s/^\(${CONFIG_PREFIX}[a-zA-Z0-9_]*\)=.*/\1/p"
> +SED_CONFIG_EXP2="s/^# \(${CONFIG_PREFIX}[a-zA-Z0-9_]*\) is not set$/\1/p"
...
> -	CFG_LIST=$(sed -n "$SED_CONFIG_EXP" $MERGE_FILE)
> +	CFG_LIST=$(sed -n -e "$SED_CONFIG_EXP1" -e "$SED_CONFIG_EXP2" $MERGE_FILE)
...
> -for CFG in $(sed -n "$SED_CONFIG_EXP" $TMP_FILE); do
> +for CFG in $(sed -n -e "$SED_CONFIG_EXP1" -e "$SED_CONFIG_EXP2" $TMP_FILE); do

Kind regards,
Petr



[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux