`<<<"$word"` appends a free newline to the array, which is somewhat
unexpected behaviour. In the case of PKGSET however, using `< <()`
instead is more than just a stylistic choice; rlpkg errors if provided
with only an empty argument:
Traceback (most recent call last):
File "/usr/lib/python-exec/python3.13/rlpkg", line 334, in <module>
main()
~~~~^^
File "/usr/lib/python-exec/python3.13/rlpkg", line 329, in main
rc += relabel_packages(packages, reset, verbose)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python-exec/python3.13/rlpkg", line 234, in relabel_packages
pkglist += find_installed_packages(pkgname)
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "/usr/lib/python-exec/python3.13/rlpkg", line 94, in
find_installed_packages
t = portage.db["/"]["vartree"].dbapi.match(search_key)
File "/usr/lib/python3.13/site-packages/portage/dbapi/vartree.py", line
626, in match
cache_key = (mydep, mydep.unevaluated_atom)
^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'unevaluated_atom'
This only shows up in cases where a policy package is pulled in by
another policy package, and has no other reverse dependencies. The
effect of this can be seen in the shell:
```
$ # note: once filtered, the list should be empty.
$ out=$(qdepends -CiqqrF '%[CATEGORY]%[PN]%[SLOT]' -Q
'sec-policy/selinux-dirmngr')
$ echo "${out}"
sec-policy/selinux-gpg:0
$ readarray -t PKGSET < <(echo "${out}" | grep -v 'sec-policy/selinux-')
$ readarray -t PKGSET2 <<<"$(echo "${out}" | grep -v 'sec-policy/selinux-')"
$ echo "${#PKGSET[@]}"
0
$ echo "${#PKGSET2[@]}" # PKGSET2 has an extra element.
1
$ echo "${PKGSET2[@]}" # It's just a newline!
```
Signed-off-by: Rahul Sandhu <[email protected]>
---
eclass/selinux-policy-2.eclass | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/eclass/selinux-policy-2.eclass b/eclass/selinux-policy-2.eclass
index 96bf57746f68..dd4617557653 100644
--- a/eclass/selinux-policy-2.eclass
+++ b/eclass/selinux-policy-2.eclass
@@ -417,7 +417,7 @@ selinux-policy-2_pkg_postinst() {
fi
# Policy packages may pull in other policy packages, filter
those out.
- readarray -t PKGSET <<<"$(echo "${out}" | grep -v
'sec-policy/selinux-')"
+ readarray -t PKGSET < <(echo "${out}" | grep -v
'sec-policy/selinux-')
[[ "${#PKGSET[@]}" -ne 0 ]] && rlpkg "${PKGSET[@]}"
fi
--
2.50.1