Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 360617 - dev-util/w32api-3.17.2: syntax error with older bash
Summary: dev-util/w32api-3.17.2: syntax error with older bash
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-26 18:26 UTC by Jouni Kosonen
Modified: 2011-03-27 05:29 UTC (History)
0 users

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


Attachments
Proposed modification to the ebuild (ebuild.diff,479 bytes, patch)
2011-03-26 18:32 UTC, Jouni Kosonen
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jouni Kosonen 2011-03-26 18:26:45 UTC
The newly added ebuild for dev-util/w32api-3.17.2 has a nasty syntax error in the version mangling code. ${P:0:-2} is not a valid expression.
Comment 1 Jouni Kosonen 2011-03-26 18:32:14 UTC
Created attachment 267315 [details, diff]
Proposed modification to the ebuild

Actual result after using with crossdev:

/usr/cross-compilers/cross-i686-pc-mingw32/w32api/w32api-3.17.2.ebuild: line 15: -2: substring expression < 0

in MY_P="${P:0:-2}-${PV:0-1}-mingw32" the ${P:0:-2} is not a valid expression.
As a result, the MY_P variable ends up empty and the fetch fails.

According to the Gentoo Development Guide
http://devmanual.gentoo.org/tools-reference/bash/index.html#bash-substring-extraction
the length parameter must not be less than zero.

In this case the following modification would work:

15c15
< MY_P="${P:0:-2}-${PV:0-1}-mingw32"
---
> MY_P="${P:0:${#P}-2}-${PV:0-1}-mingw32"

but the attached modification should work even for versions that lack the third version number position.
Comment 2 SpanKY gentoo-dev 2011-03-27 05:29:27 UTC
${P:0:-2} is a valid expression if you have a new enough bash