Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when installing phing (other packages were ok) #136

Closed
eclipxe13 opened this issue Apr 5, 2018 · 9 comments · Fixed by #142
Closed

Error when installing phing (other packages were ok) #136

eclipxe13 opened this issue Apr 5, 2018 · 9 comments · Fixed by #142

Comments

@eclipxe13
Copy link
Contributor

eclipxe13 commented Apr 5, 2018

I got this error when running

$ phive install phing
Version string '7.0.28-1' does not follow SemVer semantics

# other php versions also fail:
$ php7.1 /usr/local/bin/phive install phing
Version string '7.1.15-1' does not follow SemVer semantics

$ php7.2 /usr/local/bin/phive install phing
Version string '7.1.15-1' does not follow SemVer semantics

$ which php php7.0 php7.1 php7.2
/usr/bin/php
/usr/bin/php7.0
/usr/bin/php7.1
/usr/bin/php7.2

$ apt-show-versions php7.0-cli php7.1-cli php7.2-cli
php7.0-cli:amd64/testing 7.0.28-1 uptodate
php7.1-cli:amd64/testing 7.1.15-1 uptodate
php7.2-cli:amd64/testing 7.2.3-1 uptodate

Full output:

phive install phing
Phive 0.10.0 - Copyright (C) 2015-2018 by Arne Blankerts, Sebastian Heuer and Contributors
Downloading https://api.github.com/repos/phingofficial/phing/releases
Downloading https://github.com/phingofficial/phing/releases/download/3.0.0-alpha1/phing-3.0.0-alpha1.phar
Downloading https://github.com/phingofficial/phing/releases/download/3.0.0-alpha1/phing-3.0.0-alpha1.phar.asc
Downloading key 2420BAE0A3BE25C6
Trying hkps.pool.sks-keyservers.net (37.191.226.104)
Downloading https://hkps.pool.sks-keyservers.net/pks/lookup?search=0x2420BAE0A3BE25C6&op=index&options=mr
Downloading https://hkps.pool.sks-keyservers.net/pks/lookup?search=0x2420BAE0A3BE25C6&op=get&options=mr
Successfully downloaded key

	Fingerprint: 566E 877A 27BD 4343 E956 BC9D 2420 BAE0 A3BE 25C6

	Michiel Rook <[email protected]> (2012-04-06)

	Created: 2012-04-06

Import this key? [y|N] y
[ERROR]    An error occurred while processing your request:

          Version string '7.0.28-1' does not follow SemVer semantics
          
          #0 har:///usr/local/bin/phive/vendor/phar-io/version/src/Version.php(155)
          #1 har:///usr/local/bin/phive/vendor/phar-io/version/src/Version.php(43): PharIo\Version\Version->ensureVersionStringIsValid()
          #2 har:///usr/local/bin/phive/src/services/phar/CompatibilityService.php(52): PharIo\Version\Version->__construct()
          #3 har:///usr/local/bin/phive/src/services/phar/InstallService.php(69): PharIo\Phive\CompatibilityService->canRun()
          #4 har:///usr/local/bin/phive/src/commands/install/InstallCommand.php(57): PharIo\Phive\InstallService->execute()
          #5 har:///usr/local/bin/phive/src/commands/install/InstallCommand.php(44): PharIo\Phive\InstallCommand->installRequestedPhar()
          #6 har:///usr/local/bin/phive/src/shared/cli/Runner.php(211): PharIo\Phive\InstallCommand->execute()
          #7 har:///usr/local/bin/phive/src/shared/cli/Runner.php(70): PharIo\Phive\Cli\Runner->execute()
          #8 usr/local/bin/phive(300): PharIo\Phive\Cli\Runner->run()
          #9 {main}

          Environment: PHP 7.0.28-1
          Phive Version: 0.10.0

          This should not have happened and is most likely a bug.
          Please report it at https://github.com/phar-io/phive/issues, make sure you include
          the full output of this error message. Thank you!

Steps to reproduce:

# create an empty workspace
rm -rf x/ ; mkdir x; cd x

# remove all phive data (all clean)
rm -rf ~/.phive/

# this install pass
phive install phpstan
...
Linking /home/eclipxe/.phive/phars/phpstan.phar to /tmp/x/tools/phpstan

# this install fails
phive install phing
...
Version string '7.0.28-1' does not follow SemVer semantics
...

It does not matter if is the first package or the third to install, I did not see any problem with other packages.

Thanks for your support and your great software!

@theseer
Copy link
Member

theseer commented Apr 5, 2018

Interesting issue. Some quick analysis:

  • The problem is not related to phing as your last example when trying to install phive also fails
  • The other package probably works because no download is made but the phar gets directly linked

The error seems to occur when phive tries to use the PHP version (7.0.28-1 in your case).
For statistical reasons we include the PHP-Version in the useragent string when we talk to our server to get the latest repository list.

Phive is unhappy with a PHP version of 7.0.28-1. It's indeed not a valid PHP Version string and not semantic versioning compliant. Where does that version string come from? It's not an official PHP version.

@eclipxe13
Copy link
Contributor Author

Sorry, let me correct the entry, where it says:

# this install fails
phive install phive

must say

# this install fails
phive install phing

The result for phive install phive is:

phive install phive
Phive 0.10.0 - Copyright (C) 2015-2018 by Arne Blankerts, Sebastian Heuer and Contributors
[ERROR]    Could not resolve requested PHAR phive

@theseer
Copy link
Member

theseer commented Apr 5, 2018

Can you try running phive update-repository-list?

@eclipxe13
Copy link
Contributor Author

The other package probably works because no download is made but the phar gets directly linked.

No. See my example, I had removed my ~/.phive folder to have a clear environment. The current output for phpstan, phploc, phpab, etc... is something like:

$ phive install phploc
Phive 0.10.0 - Copyright (C) 2015-2018 by Arne Blankerts, Sebastian Heuer and Contributors
Downloading https://phar.phpunit.de/phive.xml
Downloading https://phar.phpunit.de/phploc-4.0.1.phar
Downloading https://phar.phpunit.de/phploc-4.0.1.phar.asc
Downloading key 4AA394086372C20A
Trying hkps.pool.sks-keyservers.net (37.191.226.104)
Downloading https://hkps.pool.sks-keyservers.net/pks/lookup?search=0x4AA394086372C20A&op=index&options=mr
Downloading https://hkps.pool.sks-keyservers.net/pks/lookup?search=0x4AA394086372C20A&op=get&options=mr
Successfully downloaded key

	Fingerprint: D840 6D0D 8294 7747 2937 7831 4AA3 9408 6372 C20A

	Sebastian Bergmann <[email protected]> (2014-07-19)
	Sebastian Bergmann <[email protected]> (2014-07-19)
	Sebastian Bergmann <[email protected]> (2014-07-19)
	Sebastian Bergmann <[email protected]> (2014-07-19)
	Sebastian Bergmann <[email protected]> (2014-07-19)
	Sebastian Bergmann <[email protected]> (2017-01-10)

	Created: 2014-07-19

Import this key? [y|N] y
Linking /home/eclipxe/.phive/phars/phploc-4.0.1.phar to /tmp/x/tools/phploc

Phive is unhappy with a PHP version of 7.0.28-1. It's indeed not a valid PHP Version string and not semantic versioning compliant.

It seems to me that this is what you are going to get when running on debian/ubuntu and others:

$ php --version
PHP 7.0.28-1 (cli) (built: Mar  6 2018 10:41:22) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.28-1, Copyright (c) 1999-2017, by Zend Technologies

Where does that version string come from? It's not an official PHP version.

From Debian testing. See apt-show-versions reported initially.

Can you try running phive update-repository-list?

Yes, it works fine but phing install has the same error

$ phive update-repository-list
Phive 0.10.0 - Copyright (C) 2015-2018 by Arne Blankerts, Sebastian Heuer and Contributors
Fetching respository list

$ phive install phing
Phive 0.10.0 - Copyright (C) 2015-2018 by Arne Blankerts, Sebastian Heuer and Contributors
[ERROR]    An error occurred while processing your request:

          Version string '7.0.28-1' does not follow SemVer semantics
          
          #0 har:///usr/local/bin/phive/vendor/phar-io/version/src/Version.php(155)
          #1 har:///usr/local/bin/phive/vendor/phar-io/version/src/Version.php(43): PharIo\Version\Version->ensureVersionStringIsValid()
          #2 har:///usr/local/bin/phive/src/services/phar/CompatibilityService.php(52): PharIo\Version\Version->__construct()
          #3 har:///usr/local/bin/phive/src/services/phar/InstallService.php(69): PharIo\Phive\CompatibilityService->canRun()
          #4 har:///usr/local/bin/phive/src/commands/install/InstallCommand.php(57): PharIo\Phive\InstallService->execute()
          #5 har:///usr/local/bin/phive/src/commands/install/InstallCommand.php(44): PharIo\Phive\InstallCommand->installRequestedPhar()
          #6 har:///usr/local/bin/phive/src/shared/cli/Runner.php(211): PharIo\Phive\InstallCommand->execute()
          #7 har:///usr/local/bin/phive/src/shared/cli/Runner.php(70): PharIo\Phive\Cli\Runner->execute()
          #8 usr/local/bin/phive(300): PharIo\Phive\Cli\Runner->run()
          #9 {main}

          Environment: PHP 7.0.28-1
          Phive Version: 0.10.0

          This should not have happened and is most likely a bug.
          Please report it at https://github.com/phar-io/phive/issues, make sure you include
          the full output of this error message. Thank you!

@theseer
Copy link
Member

theseer commented Apr 5, 2018

Okay, maybe I shouldn't answer tickets at 1am ;)

The crash obviously occurs in the Compatibilty Service, which processes the manifest in the phar - if included. Phing, in contrast to the other examples you tried, contains our manifest file to allow us to check compatibility and fitness of the environment (like php version and extensions required).

My assumption would be it also crashes with phive install phpunit, which also contains such a manifest.
If that's the case, this is most likely a problem in our manifest version handling.

Can you quickly verify that and, if it crashes, we have to open a ticket in the manifest component.

@eclipxe13
Copy link
Contributor Author

Installing PHPUnit works fine.

$ phive install phpunit
Phive 0.10.0 - Copyright (C) 2015-2018 by Arne Blankerts, Sebastian Heuer and Contributors
Fetching respository list
Downloading https://phar.io/data/repositories.xml
Downloading https://phar.phpunit.de/phive.xml
Downloading https://phar.phpunit.de/phpunit-7.0.3.phar
Downloading https://phar.phpunit.de/phpunit-7.0.3.phar.asc
Downloading key 4AA394086372C20A
Trying hkps.pool.sks-keyservers.net (193.164.133.100)
Downloading https://hkps.pool.sks-keyservers.net/pks/lookup?search=0x4AA394086372C20A&op=index&options=mr
Downloading https://hkps.pool.sks-keyservers.net/pks/lookup?search=0x4AA394086372C20A&op=get&options=mr
Successfully downloaded key

	Fingerprint: D840 6D0D 8294 7747 2937 7831 4AA3 9408 6372 C20A

	Sebastian Bergmann <[email protected]> (2014-07-19)
	Sebastian Bergmann <[email protected]> (2014-07-19)
	Sebastian Bergmann <[email protected]> (2014-07-19)
	Sebastian Bergmann <[email protected]> (2014-07-19)
	Sebastian Bergmann <[email protected]> (2014-07-19)
	Sebastian Bergmann <[email protected]> (2017-01-10)

	Created: 2014-07-19

Import this key? [y|N] y
Linking /home/eclipxe/.phive/phars/phpunit-7.0.3.phar to /tmp/x/tools/phpunit

I'ts 6:00pm here! try to sleep, we can check this out other time.

@eclipxe13
Copy link
Contributor Author

For the record, install version 2.16.1 works fine:

$ phive install phing=2.16.1
Phive 0.10.0 - Copyright (C) 2015-2018 by Arne Blankerts, Sebastian Heuer and Contributors
Downloading https://api.github.com/repos/phingofficial/phing/releases
Downloading https://github.com/phingofficial/phing/releases/download/2.16.1/phing-2.16.1.phar
Downloading https://github.com/phingofficial/phing/releases/download/2.16.1/phing-2.16.1.phar.asc
Linking /home/eclipxe/.phive/phars/phing-2.16.1.phar to /tmp/x/tools/phing

@theseer
Copy link
Member

theseer commented Apr 6, 2018

Okay, makes sense actually:

  • PHPUnit doesn't have a manifest.xml yet - I assumed he'd be using it already, but it's pending
  • Phing 2.16.1 does not have a manifest.xml either

So, it seems to be the manifest version comparsion code that has issues with Debian's broken PHP Version string. Despite the fact I consider that a Debian bug - they break semver - I'll open a ticket on that for us and try to get a fix out soon.

@theseer
Copy link
Member

theseer commented Apr 6, 2018

For the record: phar-io/version#10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants