Pear should not return error code when package is already installed

[email protected] (Martin Rys) Mon, 1 Feb 2021 14:37:15 +0100
Newsgroups php.pear.dev
Message-ID <CACbE=3p-NR-bcURFU7za-0VkwP8g6d+yCNVisBJcqcMuobAydg@mail.gmail.com>
Hi, hopefully I got to the correct mailing list.

Here's the crux of my issue:

# pecl install oci8
  pecl/oci8 is already installed and is the same as the released version 3.0.1
  install failed
# echo $?
  1

If the package is already correctly installed and up to date, pear
throws an error code.

This is inconsistent with every other package manager out there, and
even pear itself, as uninstalling a package that is not installed does
not throw an error, where one would expect it to from the install
behavior.

# pecl uninstall oci8
  pecl/oci8 not installed
# echo $?
  0

Would it be possible to change the behavior to not error in this specific case?

People using pear(pecl) in scripts are having a hard time making
idempotent scripts because of it.
https://superuser.com/questions/1150311/how-can-i-idempotently-pecl-install-a-module-twice/1150477

---

Side note, 72 files have a header that they're compatible with PHP 4
and 5, where Pear has no issue running up to PHP 8. They should be
updated/removed.

Checked via - grep -Ril 'PHP versions 4 and 5'

Thanks,
Martin