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

It doesn't move chromedriver to vendor/bin because is_executable is false #1

Open
Luc45 opened this issue Sep 2, 2020 · 1 comment

Comments

@Luc45
Copy link

Luc45 commented Sep 2, 2020

The problem

Running composer update downloads Chromedriver to vaimo/binary-chromedriver/downloads/chromedriver but doesn't move it to vendor/bin/chromedriver

The reason

After PHP downloads the chromedriver binary and saves it on vaimo/binary-chromedriver/downloads/chromedriver, it comes with the permission 0644, which is not executable.

The PackageManager only moves to vendor/bin/chromedriver if the file is executable: https://github.com/vaimo/webdriver-binary-downloader/blob/master/src/Managers/PackageManager.php#L111

Therefore it doesn't move the file.

A proposed solution

Try to set executable permissions on the binary after downloading it (check if the permission is copied when moving the file as well). Let the user know if that fails.

Quick workaround

I've just added chmod($this->systemUtils->composePath($sourceDir, $binary), 0754); before line 80 in https://github.com/vaimo/webdriver-binary-downloader/blob/master/src/Managers/PackageManager.php#L80. Worked fine.

Environment

➜  ~ cat /etc/lsb-release 
DISTRIB_ID=ManjaroLinux
DISTRIB_RELEASE=20.1
DISTRIB_CODENAME=Mikah
DISTRIB_DESCRIPTION="Manjaro Linux"

➜  ~ php --version
PHP 7.4.9 (cli) (built: Aug 22 2020 04:49:27) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Xdebug v2.9.6, Copyright (c) 2002-2020, by Derick Rethans

➜  ~ composer --version
Composer version 1.10.10 2020-08-03 11:35:19

➜  pro git:(feat/wp-browser) ✗ composer show (output adjusted to show only relevant packages)
vaimo/binary-chromedriver         5.0.3 
vaimo/webdriver-binary-downloader 2.2.4
@Luc45
Copy link
Author

Luc45 commented Sep 2, 2020

This issue was happening to me, but not to my colleague or in CI, so I've dived deeper to find out what was the difference.

Turns out that both my colleague and CI are running Ubuntu, and they have unzip. I don't have unzip, so it unzips the package with PHP, which causes the permission to be 0644 instead of 0755.

I've installed unzip in my system, removed the chmod and it worked.

Either way, the chmod seems a good thing to have in place for those that don't have unzip installed :)

Thanks!

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

No branches or pull requests

1 participant