commit:     a4c6e0989d1233ba475b0b890d9d084b113682be
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Sat Feb 29 00:46:24 2020 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Sat Feb 29 22:00:00 2020 +0000
URL:        https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=a4c6e098

src/php.eselect.in.in: enable nullglob during find_targets().

While it didn't appear to hurt anything, the find_targets() function
could output a literal "php*.*" when there were no valid PHP targets.
Now the "nullglob" shell option is enabled during that function.

Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>

 src/php.eselect.in.in | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/php.eselect.in.in b/src/php.eselect.in.in
index a047c62..12ef1e1 100644
--- a/src/php.eselect.in.in
+++ b/src/php.eselect.in.in
@@ -246,10 +246,12 @@ update_sapi() {
 # A space-separated list of target names, for example, "php5.6 php7.0".
 #
 find_targets() {
-       # TODO: when there aren't any phpX.Y directories, this returns
-       # "php*.*". This doesn't seem to bother our consumers, but it
-       # would probably be more polite to return nothing in that case.
+       # Temporarily enable the "nullglob" shell option to ensure that we
+       # don't return a literal "php*.*" when there are no valid targets.
+       local shopt_nullglob_saved=$(shopt -p nullglob)
+       shopt -s nullglob
        cd "${ROOT%/}@LIBDIR@" && echo php*.*
+       ${shopt_nullglob_saved}
 }
 
 # List all valid targets for the given SAPI. The list is obtained by

Reply via email to