From: Bill Pringlemeir <bpringlemeir@nbsps.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] v2015.01-rc4 REGRESSION: "scripts: fix binutils-version.sh" breaks things for non Linaro toolchains
Date: Tue, 06 Jan 2015 16:32:26 -0500 [thread overview]
Message-ID: <8761cj8uj9.fsf@nbsps.com> (raw)
In-Reply-To: 20150106154622.GO10826@bill-the-cat
On 6 Jan 2015, trini at ti.com wrote:
> On Tue, Jan 06, 2015 at 11:27:43AM +0100, Hans de Goede wrote:
>> Hi all,
>>
>> ping ? current master still has this regression, it is not fatal,
>> but it is not
>> pretty either.
>
> Did you see my earlier reply? It's OK with vanilla toolchains (see
> ELDK) and Linaro ones, but breaking on how Fedora mangles the version
> string. I'm _not_ saying it's a Fedora problem, but can you poke at
> this a bit? If not, I'll play with echo and see if I can do it.
I did a shell check on this script,
shellcheck -f gcc binutils-version.sh
binutils-version.sh:13:9: warning: Don't use variables in the printf format string. Use printf "..%s.." "$foo". [SC2059]
binutils-version.sh:19:14: note: Double quote to prevent globbing and word splitting. [SC2086]
binutils-version.sh:20:14: note: Double quote to prevent globbing and word splitting. [SC2086]
binutils-version.sh:22:22: note: Double quote to prevent globbing and word splitting. [SC2086]
binutils-version.sh:22:29: note: Double quote to prevent globbing and word splitting. [SC2086]
diff --git a/scripts/binutils-version.sh b/scripts/binutils-version.sh
index 0bc26cf..955267d 100755
--- a/scripts/binutils-version.sh
+++ b/scripts/binutils-version.sh
@@ -5,7 +5,6 @@
# Prints the binutils version of `gas-command' in a canonical 4-digit form
# such as `0222' for binutils 2.22
#
-
gas="$*"
if [ ${#gas} -eq 0 ]; then
@@ -14,9 +13,9 @@ if [ ${#gas} -eq 0 ]; then
exit 1
fi
-version_string=$($gas --version | head -1 | sed -e 's/.*) *\([0-9.]*\).*/\1/' )
+version_string=$($gas --version | head -1 | sed -e 's/.*) *\([0-9\.]*\).*/\1/' )
-MAJOR=$(echo $version_string | cut -d . -f 1)
-MINOR=$(echo $version_string | cut -d . -f 2)
+MAJOR=$(echo "$version_string" | cut -d . -f 1)
+MINOR=$(echo "$version_string" | cut -d . -f 2)
-printf "%02d%02d\\n" $MAJOR $MINOR
+printf "%02d%02d\\n" "$MAJOR" "$MINOR"
The main issue is quoting of the 'sed' expression. We had regex [0-9.],
but we want [0-9\.] so that we match a literal '.' as opposed to
anything. Or so I speculate. I made a script that output the version
info Hans has and after the patch it is fine.
next prev parent reply other threads:[~2015-01-06 21:32 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-30 10:55 [U-Boot] v2015.01-rc4 REGRESSION: "scripts: fix binutils-version.sh" breaks things for non Linaro toolchains Hans de Goede
2014-12-30 13:50 ` Tom Rini
2015-01-06 10:27 ` Hans de Goede
2015-01-06 15:46 ` Tom Rini
2015-01-06 21:32 ` Bill Pringlemeir [this message]
2015-01-06 22:01 ` Bill Pringlemeir
2015-01-06 22:07 ` Tom Rini
2015-01-06 22:25 ` [U-Boot] [PATCH] scripts: fix binutils-version.sh for 'as' without a package Bill Pringlemeir
2015-01-06 22:38 ` Bill Pringlemeir
2015-01-07 12:01 ` Masahiro Yamada
2015-01-07 15:34 ` [U-Boot] [PATCH v3] " Bill Pringlemeir
2015-01-08 8:56 ` Masahiro Yamada
2015-01-08 10:18 ` Hans de Goede
2015-01-09 13:34 ` [U-Boot] [U-Boot, " Tom Rini
2015-01-07 15:42 ` [U-Boot] [PATCH] " Bill Pringlemeir
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=8761cj8uj9.fsf@nbsps.com \
--to=bpringlemeir@nbsps.com \
--cc=u-boot@lists.denx.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.