[Slackbuilds-users] Possible typo in python3.SlackBuild

Jim Diamond Jim.Diamond at acadiau.ca
Fri Jan 9 17:34:03 UTC 2015


On Fri, Jan  9, 2015 at 17:09 (+1000), Christoph Willing wrote:

> On 01/09/2015 04:35 PM, Niki Kovacs wrote:
>>Hi,

>>I just noticed a strange line in python3.SlackBuild:

>>PYVER=${VERSION::3}

>>I only know this kind of notation:

>>PYVER=${VERSION:-3}

>>Is this an error or some special syntax I don't know?

> From the Parameter Expansion section of the bash manpage:

> ${parameter:offset:length}
> Substring  Expansion.  Expands to up to length characters of the
> value of parameter starting at the character specified  by  off-set.

> Its not stated there but I presume a blank offset defaults it to 0,
> therefore for a VERSION of 3.4.2, PYVER would be set to 3.4

That is fragile code.  If VERSION got as high as 3.10.x, Bad Things
would happen.

Cheers.
                                Jim


More information about the SlackBuilds-users mailing list