Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 561228 - net-analyzer/rrdtool-1.5.4 - pkg_postinst(): bash: [[: 1.3: syntax error: invalid arithmetic operator (error token is ".3")
Summary: net-analyzer/rrdtool-1.5.4 - pkg_postinst(): bash: [[: 1.3: syntax error: inv...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All All
: Normal minor
Assignee: Gentoo Netmon project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-23 03:43 UTC by Arfrever Frehtes Taifersar Arahesis
Modified: 2015-09-23 06:05 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Arfrever Frehtes Taifersar Arahesis 2015-09-23 03:43:32 UTC
pkg_postinst() {
        if [[ ${REPLACING_VERSIONS} -le 1.3 ]]; then
                ...



$ [[ ${REPLACING_VERSIONS} -le 1.3 ]]
bash: [[: 1.3: syntax error: invalid arithmetic operator (error token is ".3")
$
Comment 1 Arfrever Frehtes Taifersar Arahesis 2015-09-23 04:32:53 UTC
I thought that problem was obvious, but apparently it is not :( .

-lt, -le, -gt, -ge, -eq, -ne operators support only integers. 1.3 is not integer.

$ [[ 1 -le 3 ]] ; echo $?
0
$ [[ 3 -le 3 ]] ; echo $?
0
$ [[ 4 -le 3 ]] ; echo $?
1
$ [[ 1.5 -le 3 ]] ; echo $?
bash: [[: 1.5: syntax error: invalid arithmetic operator (error token is ".5")
1
$ [[ 1 -le 1.5 ]] ; echo $?
bash: [[: 1.5: syntax error: invalid arithmetic operator (error token is ".5")
1
$
Comment 2 Arfrever Frehtes Taifersar Arahesis 2015-09-23 04:43:38 UTC
Maybe version_is_at_least() from versionator.eclass could be used.

local ver
for ver in ${REPLACING_VERSIONS}; do
  if ! version_is_at_least 1.3 ${ver}; then
    ewarn ...
    break
  fi
done
Comment 3 Jeroen Roovers (RETIRED) gentoo-dev 2015-09-23 05:57:37 UTC
Sounds good.
Comment 4 Jeroen Roovers (RETIRED) gentoo-dev 2015-09-23 05:58:49 UTC
Why would we expect multiple REPLACING_VERSIONS here?
Comment 5 Jeroen Roovers (RETIRED) gentoo-dev 2015-09-23 06:04:11 UTC
You know what. rrdtool-1.2 was removed from the tree some 4 years ago. I have removed this obsolete piece of advice altogether.
Comment 6 Arfrever Frehtes Taifersar Arahesis 2015-09-23 06:05:07 UTC
https://projects.gentoo.org/pms/5/pms.html
"Table 11.1: Defined variables
...
REPLACING_VERSIONS ... A whitespace-separated list of versions of this package (including revision, if specified) that are being replaced (uninstalled or overwritten) as a result of this install.
...
11.1.2 REPLACING_VERSIONS and REPLACED_BY_VERSION
...
REPLACING_VERSIONS is a list, not a single optional value, to handle pathological cases such as installing foo-2:2 to replace foo-2:1 and foo-3:2."