mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Michael Olbrich <m.olbrich@pengutronix.de>
To: ptxdist@pengutronix.de
Subject: Re: [ptxdist] [PATCH] ptxd_lib_dgen.awk: Fix warning
Date: Thu, 30 Apr 2015 20:56:00 +0200	[thread overview]
Message-ID: <20150430185600.GE6740@pengutronix.de> (raw)
In-Reply-To: <1430334378-32456-1-git-send-email-bernhard@bwalle.de>

On Wed, Apr 29, 2015 at 09:06:18PM +0200, Bernhard Walle wrote:
> After upgrading my gawk to 4.1.2 (which Arch Linux did today), I get
> tons of warnings like
> 
> gawk: /usr/lib/ptxdist-2015.04.0/scripts/lib/ptxd_lib_dgen.awk:386:
> (FILENAME=/tmp/ptxdist.p1sg2M/dgen/platformconfig FNR=233) warning:
> gensub: third argument `' treated as 1
> 
> This patch fixes the warnings. According to the documentation
> https://www.gnu.org/software/gawk/manual/gawk.html#String-Functions:
> 
> | gensub(regexp, replacement, how [, target]) #
> | ...
> |
> | If the how argument is a string that does not begin with ‘g’ or ‘G’, or
> | if it is a number that is less than or equal to zero, only one
> | substitution is performed. If how is zero, gawk issues a warning
> | message.
> 
> So the fix should be safe.

Yes, this seems to be the correct fix. Works for me[tm] anyways.
Thanks, applied.

Michael

> Signed-off-by: Bernhard Walle <bernhard@bwalle.de>
> ---
>  scripts/lib/ptxd_lib_dgen.awk | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/scripts/lib/ptxd_lib_dgen.awk b/scripts/lib/ptxd_lib_dgen.awk
> index 9970953..c255706 100644
> --- a/scripts/lib/ptxd_lib_dgen.awk
> +++ b/scripts/lib/ptxd_lib_dgen.awk
> @@ -89,7 +89,7 @@ $1 ~ /^[A-Z_]*PACKAGES-/ {
>  	this_PKG = gensub(/^[A-Z_]*PACKAGES-\$\(PTXCONF_([^\)]*)\)/, "\\1", "g", $1);
>  	this_PKG = gensub(/^[A-Z0-9_]*-\$\(PTXCONF_([^\)]*)\)/, "\\1", "g", this_PKG);
>  
> -	is_pkg = this_pkg = gensub(/^[[:space:]]*\<(.*)\>[[:space:]]*$/,"\\1","", $2);
> +	is_pkg = this_pkg = gensub(/^[[:space:]]*\<(.*)\>[[:space:]]*$/,"\\1",1, $2);
>  	if (this_pkg ~ /[A-Z]+/) {
>  		print \
>  			"\n" \
> @@ -222,8 +222,8 @@ function write_vars_pkg_all(this_PKG, this_pkg, prefix) {
>  	print this_PKG "_DEVPKG = " prefix this_devpkg			> DGEN_DEPS_PRE;
>  	print this_PKG "_SOURCES = $(" this_PKG "_SOURCE)"		> DGEN_DEPS_PRE
>  
> -	target_PKG = gensub(/^HOST_|^CROSS_/, "", "", this_PKG);
> -	PREFIX = gensub(/^(HOST_|CROSS_).*/, "\\1", "", this_PKG);
> +	target_PKG = gensub(/^HOST_|^CROSS_/, "", 1, this_PKG);
> +	PREFIX = gensub(/^(HOST_|CROSS_).*/, "\\1", 1, this_PKG);
>  
>  	# define default ${PKG}, ${PKG}_SOURCE, ${PKG}_DIR
>  	if ((prefix != "") && (target_PKG in PKG_to_pkg)) {
> @@ -352,7 +352,7 @@ function write_deps_pkg_active_image(this_PKG, this_pkg, prefix) {
>  	n = split(this_PKG_DEPS, this_DEP_array, " ");
>  	for (i = 1; i <= n; i++) {
>  		this_dep = PKG_to_pkg[this_DEP_array[i]]
> -		this_dep_prefix = gensub(/^(host-|cross-|image-|).*/, "\\1", "", this_dep)
> +		this_dep_prefix = gensub(/^(host-|cross-|image-|).*/, "\\1", 1, this_dep)
>  		if (this_dep_prefix == "")
>  			print "$(" this_PKG "_IMAGE): "         "$(STATEDIR)/" this_dep ".targetinstall.post"	> DGEN_DEPS_POST;
>  		else
> @@ -371,7 +371,7 @@ END {
>  	# for all pkgs
>  	for (this_PKG in PKG_to_pkg) {
>  		this_pkg = PKG_to_pkg[this_PKG];
> -		this_pkg_prefix = gensub(/^(host-|cross-|image-|).*/, "\\1", "", this_pkg)
> +		this_pkg_prefix = gensub(/^(host-|cross-|image-|).*/, "\\1", 1, this_pkg)
>  
>  		write_include(this_PKG)
>  		if (this_pkg_prefix != "image-") {
> @@ -383,7 +383,7 @@ END {
>  	# for active pkgs
>  	for (this_PKG in active_PKG_to_pkg) {
>  		this_pkg = PKG_to_pkg[this_PKG];
> -		this_pkg_prefix = gensub(/^(host-|cross-|image-|).*/, "\\1", "", this_pkg)
> +		this_pkg_prefix = gensub(/^(host-|cross-|image-|).*/, "\\1", 1, this_pkg)
>  
>  		if (this_pkg_prefix != "image-") {
>  			write_deps_pkg_active(this_PKG, this_pkg, this_pkg_prefix)
> -- 
> 2.3.7
> 
> 
> -- 
> ptxdist mailing list
> ptxdist@pengutronix.de

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

-- 
ptxdist mailing list
ptxdist@pengutronix.de

      reply	other threads:[~2015-04-30 18:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-29 19:06 Bernhard Walle
2015-04-30 18:56 ` Michael Olbrich [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150430185600.GE6740@pengutronix.de \
    --to=m.olbrich@pengutronix.de \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox