summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2018-03-08 16:48:39 +0100
committerMichał Górny <mgorny@gentoo.org>2018-07-09 18:54:45 +0200
commit64d475cac5a2e4ca9a63a3f158c6f6ee745cb9a0 (patch)
tree6bb5139f7a8d03d9ddb4d414a373e67b28394a28
parentprofiles/arch/powerpc: Move x11-wm/sawfish[kde] mask to top profile (diff)
downloadgentoo-64d475cac5a2e4ca9a63a3f158c6f6ee745cb9a0.tar.gz
gentoo-64d475cac5a2e4ca9a63a3f158c6f6ee745cb9a0.tar.bz2
gentoo-64d475cac5a2e4ca9a63a3f158c6f6ee745cb9a0.zip
linux-info.eclass: get_localversion, do not call 'ls'
Use bash array to perform a safe filename glob instead of calling 'ls'. Also, use nullglob to cleanly handle no matches instead of silencing errors.
-rw-r--r--eclass/linux-info.eclass7
1 files changed, 6 insertions, 1 deletions
diff --git a/eclass/linux-info.eclass b/eclass/linux-info.eclass
index dd62b26855d2..0eca55725874 100644
--- a/eclass/linux-info.eclass
+++ b/eclass/linux-info.eclass
@@ -390,8 +390,13 @@ kernel_is() {
get_localversion() {
local lv_list i x
+ local shopt_save=$(shopt -p nullglob)
+ shopt -s nullglob
+ local files=( ${1}/localversion* )
+ ${shopt_save}
+
# ignore files with ~ in it.
- for i in $(ls ${1}/localversion* 2>/dev/null); do
+ for i in "${files[@]}"; do
[[ -n ${i//*~*} ]] && lv_list="${lv_list} ${i}"
done