1 |
Use bash array to perform a safe filename glob instead of calling 'ls'. |
2 |
Also, use nullglob to cleanly handle no matches instead of silencing |
3 |
errors. |
4 |
--- |
5 |
eclass/linux-info.eclass | 7 ++++++- |
6 |
1 file changed, 6 insertions(+), 1 deletion(-) |
7 |
|
8 |
diff --git a/eclass/linux-info.eclass b/eclass/linux-info.eclass |
9 |
index 035b722e2d6d..b8c1a524bae8 100644 |
10 |
--- a/eclass/linux-info.eclass |
11 |
+++ b/eclass/linux-info.eclass |
12 |
@@ -390,8 +390,13 @@ kernel_is() { |
13 |
get_localversion() { |
14 |
local lv_list i x |
15 |
|
16 |
+ local shopt_save=$(shopt -p nullglob) |
17 |
+ shopt -s nullglob |
18 |
+ local files=( ${1}/localversion* ) |
19 |
+ ${shopt_save} |
20 |
+ |
21 |
# ignore files with ~ in it. |
22 |
- for i in $(ls ${1}/localversion* 2>/dev/null); do |
23 |
+ for i in "${files[@]}"; do |
24 |
[[ -n ${i//*~*} ]] && lv_list="${lv_list} ${i}" |
25 |
done |
26 |
|
27 |
-- |
28 |
2.16.2 |