What are you trying to do?
I discovered this edge case by accident while looking at the new pie-extensions/redis package. After downloading it, I decided I didn't want to install a random, as of yet untrusted, binary, so I installed the upstream phpredis/phpredis package instead, and that's where the fun began. The following is reproducible for me.
What platform, and PIE version are you using?
Amazon Linux 2023
🥧 PHP Installer for Extensions (PIE) 1.4.2, from The PHP Foundation
You are running PHP 8.4.19
Target PHP installation: 8.4.19 nts, on Linux/OSX/etc x86_64 (from /usr/bin/php)
Steps to reproduce the issue
pie download -v pie-extensions/redis
pie install -v phpredis/phpredis
pie uninstall -v pie-extensions/redis
pie uninstall -v phpredis/phpredis
What do you expect to happen?
pie-extensions/redis source downloaded to my home directory (only contains a binary)
phpredis/phpredis source downloaded to my home directory, compiled, and binary installed, without affecting the pie-extensions/redis download
- redis.so from
pie-extensions/redis should be deleted from my home directory with no errors, without touching the phpredis/phpredis installation
phpredis/phpredis extension should be disabled, binary deleted from /usr/lib64/php8.4/modules, and source deleted from my home directory, with no errors
What is actually happening
- Working as expected
- Extension extracted to: .config/pie/php8.4_35840a531d0d3687d23bdc9551cc8a03/vendor/pie-extensions/redis/redis.so (2617232 bytes)
- Extension is downloaded and compiled
- Extension installed to: /usr/lib64/php8.4/modules/redis.so (2555792 bytes)
pie show now shows the other package as being loaded:
Loaded PIE extensions:
redis:6.3.0 (from 🥧 pie-extensions/redis:6.3.0)
- The redis.so binary from
pie-extensions/redis has been deleted from .config/pie/php8.4_35840a531d0d3687d23bdc9551cc8a03/vendor/pie-extensions/redis/
- The
phpredis/phpredis source was deleted after installation (perhaps this is intentional?)
- "Uninstall of pie-extensions/redis failed: PIE metadata was missing for package pie-extensions/redis. Missing metadata keys: pie-installed-binary, pie-installed-binary-checksum"
-
pie show now indicates:
Loaded PIE extensions:
(none)
PIE packages not loaded:
These extensions were installed with PIE but are not currently enabled.
- pie-extensions/redis:6.3.0
-
redis.so from phpredis/phpredis still installed at /usr/lib64/php8.4/modules/redis.so
- No package found: phpredis/phpredis
phpredis/phpredis is still present in .config/pie/php8.4_35840a531d0d3687d23bdc9551cc8a03/pie.json:
{
"require": {
"phpredis/phpredis": "^6.3"
}
}
Complete logs/output
This is from step 3: pie uninstall -v pie-extensions/redis:
- Loading composer repositories with package information
Updating dependencies
Lock file operations: 0 installs, 0 updates, 1 removal
- Removing pie-extensions/redis (6.3.0)
Writing lock file
Installing dependencies from lock file
Package operations: 0 installs, 0 updates, 1 removal
- Removing pie-extensions/redis (6.3.0)
INI file "/etc/php.d/60-redis.ini" was updated to remove the extension.
Uninstall of pie-extensions/redis failed
In PackageMetadataMissing.php line 26:
[Php\Pie\Installing\PackageMetadataMissing]
PIE metadata was missing for package pie-extensions/redis. Missing metadata keys: pie-installed-binary, pie-installed-binary-checksum
Exception trace:
at phar:///usr/local/bin/pie/src/Installing/PackageMetadataMissing.php:26
Php\Pie\Installing\PackageMetadataMissing::duringUninstall() at phar:///usr/local/bin/pie/src/Installing/UninstallUsingUnlink.php:30
Php\Pie\Installing\UninstallUsingUnlink->__invoke() at phar:///usr/local/bin/pie/src/ComposerIntegration/UninstallProcess.php:55
Php\Pie\ComposerIntegration\UninstallProcess->__invoke() at phar:///usr/local/bin/pie/src/ComposerIntegration/PiePackageInstaller.php:106
Php\Pie\ComposerIntegration\PiePackageInstaller->{closure:Php\Pie\ComposerIntegration\PiePackageInstaller::uninstall():81}() at phar:///usr/local/bin/pie/vendor/react/promise/src/Internal/FulfilledPromise.php:47
React\Promise\Internal\FulfilledPromise->then() at phar:///usr/local/bin/pie/src/ComposerIntegration/PiePackageInstaller.php:81
Php\Pie\ComposerIntegration\PiePackageInstaller->uninstall() at phar:///usr/local/bin/pie/vendor/composer/composer/src/Composer/Installer/InstallationManager.php:525
Composer\Installer\InstallationManager->uninstall() at phar:///usr/local/bin/pie/vendor/composer/composer/src/Composer/Installer/InstallationManager.php:382
Composer\Installer\InstallationManager->{closure:Composer\Installer\InstallationManager::executeBatch():381}() at phar:///usr/local/bin/pie/vendor/react/promise/src/Internal/FulfilledPromise.php:47
React\Promise\Internal\FulfilledPromise->then() at phar:///usr/local/bin/pie/vendor/composer/composer/src/Composer/Installer/InstallationManager.php:381
Composer\Installer\InstallationManager->executeBatch() at phar:///usr/local/bin/pie/vendor/composer/composer/src/Composer/Installer/InstallationManager.php:323
Composer\Installer\InstallationManager->downloadAndExecuteBatch() at phar:///usr/local/bin/pie/vendor/composer/composer/src/Composer/Installer/InstallationManager.php:221
Composer\Installer\InstallationManager->execute() at phar:///usr/local/bin/pie/vendor/composer/composer/src/Composer/Installer.php:847
Composer\Installer->doInstall() at phar:///usr/local/bin/pie/vendor/composer/composer/src/Composer/Installer.php:657
Composer\Installer->doUpdate() at phar:///usr/local/bin/pie/vendor/composer/composer/src/Composer/Installer.php:302
Composer\Installer->run() at phar:///usr/local/bin/pie/src/ComposerIntegration/ComposerIntegrationHandler.php:138
Php\Pie\ComposerIntegration\ComposerIntegrationHandler->runUninstall() at phar:///usr/local/bin/pie/src/Command/UninstallCommand.php:98
Php\Pie\Command\UninstallCommand->execute() at phar:///usr/local/bin/pie/vendor/symfony/console/Command/Command.php:326
Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/pie/vendor/symfony/console/Application.php:1121
Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/pie/vendor/symfony/console/Application.php:324
Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/pie/vendor/symfony/console/Application.php:175
Symfony\Component\Console\Application->run() at phar:///usr/local/bin/pie/bin/pie:62
require() at /usr/local/bin/pie:16
uninstall [--with-php-config WITH-PHP-CONFIG] [--with-php-path WITH-PHP-PATH] [--with-phpize-path WITH-PHPIZE-PATH] [--no-cache] [--] <package-name>
Anything else?
In the end, I just deleted my .config/pie directory and started over. Everything works great if I stick to a single redis package.
What are you trying to do?
I discovered this edge case by accident while looking at the new pie-extensions/redis package. After downloading it, I decided I didn't want to install a random, as of yet untrusted, binary, so I installed the upstream
phpredis/phpredispackage instead, and that's where the fun began. The following is reproducible for me.What platform, and PIE version are you using?
Amazon Linux 2023
Steps to reproduce the issue
pie download -v pie-extensions/redispie install -v phpredis/phpredispie uninstall -v pie-extensions/redispie uninstall -v phpredis/phpredisWhat do you expect to happen?
pie-extensions/redissource downloaded to my home directory (only contains a binary)phpredis/phpredissource downloaded to my home directory, compiled, and binary installed, without affecting thepie-extensions/redisdownloadpie-extensions/redisshould be deleted from my home directory with no errors, without touching thephpredis/phpredisinstallationphpredis/phpredisextension should be disabled, binary deleted from /usr/lib64/php8.4/modules, and source deleted from my home directory, with no errorsWhat is actually happening
pie shownow shows the other package as being loaded:pie-extensions/redishas been deleted from.config/pie/php8.4_35840a531d0d3687d23bdc9551cc8a03/vendor/pie-extensions/redis/phpredis/phpredissource was deleted after installation (perhaps this is intentional?)pie shownow indicates:Loaded PIE extensions:
(none)
PIE packages not loaded:
These extensions were installed with PIE but are not currently enabled.
redis.so from
phpredis/phpredisstill installed at /usr/lib64/php8.4/modules/redis.sophpredis/phpredisis still present in.config/pie/php8.4_35840a531d0d3687d23bdc9551cc8a03/pie.json:Complete logs/output
This is from step 3:
pie uninstall -v pie-extensions/redis:Anything else?
In the end, I just deleted my
.config/piedirectory and started over. Everything works great if I stick to a single redis package.