* [gentoo-portage-dev] Fix Misc. Bash Errors in phase-helpers.sh.
@ 2018-02-04 7:55 R0b0t1
0 siblings, 0 replies; only message in thread
From: R0b0t1 @ 2018-02-04 7:55 UTC (permalink / raw
To: gentoo-portage-dev
[-- Attachment #1: Type: text/plain, Size: 480 bytes --]
On line 699, I suspect the test may erroneously expand into:
if [ -f ./Makefile ./makefile -o -f ./GNUmakefile ] ; then
If both files are present. The test was changed to include both names
explicitly. It could also be rewritten with [[, but it seems like it
would still either need a loop or multiple tests.
The other changes are almost stylistic. I made a PR
(https://github.com/gentoo/portage/pull/251) before I remembered that
that repo was a mirror.
Cheers,
R0b0t1
[-- Attachment #2: 0001-Fix-misc.-bash-errors.patch --]
[-- Type: text/x-patch, Size: 2772 bytes --]
From f93e8e1b1e8df555fe90d2efdb68afa314d0719e Mon Sep 17 00:00:00 2001
From: Sid Spry <R030t1@gmail.com>
Date: Sat, 3 Feb 2018 23:44:56 -0800
Subject: [PATCH] Fix misc. bash errors.
---
bin/phase-helpers.sh | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index 9b1f6adbe..282eb5665 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -696,7 +696,7 @@ einstall() {
unset EI_DESTLIBDIR
fi
- if [ -f ./[mM]akefile -o -f ./GNUmakefile ] ; then
+ if [ -f ./Makefile -o -f ./makefile -o -f ./GNUmakefile ] ; then
if [ "${PORTAGE_DEBUG}" == "1" ]; then
${MAKE:-make} -n prefix="${ED}usr" \
datadir="${ED}usr/share" \
@@ -810,7 +810,7 @@ __eapi4_src_install() {
__eapi6_src_prepare() {
if [[ $(declare -p PATCHES 2>/dev/null) == "declare -a"* ]]; then
- [[ -n ${PATCHES[@]} ]] && eapply "${PATCHES[@]}"
+ [[ -n ${PATCHES[*]} ]] && eapply "${PATCHES[@]}"
elif [[ -n ${PATCHES} ]]; then
eapply ${PATCHES}
fi
@@ -965,7 +965,7 @@ if ___eapi_has_einstalldocs; then
[[ -f ${d} && -s ${d} ]] && docinto / && dodoc "${d}"
done
elif [[ $(declare -p DOCS) == "declare -a"* ]] ; then
- [[ ${DOCS[@]} ]] && docinto / && dodoc -r "${DOCS[@]}"
+ [[ ${DOCS[*]} ]] && docinto / && dodoc -r "${DOCS[@]}"
else
[[ ${DOCS} ]] && docinto / && dodoc -r ${DOCS}
fi
@@ -973,7 +973,7 @@ if ___eapi_has_einstalldocs; then
(
if [[ $(declare -p HTML_DOCS 2>/dev/null) == "declare -a"* ]] ; then
- [[ ${HTML_DOCS[@]} ]] && \
+ [[ ${HTML_DOCS[*]} ]] && \
docinto html && dodoc -r "${HTML_DOCS[@]}"
else
[[ ${HTML_DOCS} ]] && \
@@ -1014,6 +1014,7 @@ if ___eapi_has_eapply; then
local i found_doublehyphen
# first, try to split on --
for (( i = 1; i <= ${#@}; ++i )); do
+ # shellcheck disable=SC2199
if [[ ${@:i:1} == -- ]]; then
patch_options=( "${@:1:i-1}" )
files=( "${@:i+1}" )
@@ -1025,6 +1026,7 @@ if ___eapi_has_eapply; then
# then, try to split on first non-option
if [[ -z ${found_doublehyphen} ]]; then
for (( i = 1; i <= ${#@}; ++i )); do
+ # shellcheck disable=SC2199
if [[ ${@:i:1} != -* ]]; then
patch_options=( "${@:1:i-1}" )
files=( "${@:i}" )
@@ -1040,7 +1042,7 @@ if ___eapi_has_eapply; then
done
fi
- if [[ -z ${files[@]} ]]; then
+ if [[ -z ${files[*]} ]]; then
die "eapply: no files specified"
fi
@@ -1062,7 +1064,7 @@ if ___eapi_has_eapply; then
local files=()
_eapply_get_files "${f}"
- [[ -z ${files[@]} ]] && die "No *.{patch,diff} files in directory ${f}"
+ [[ -z ${files[*]} ]] && die "No *.{patch,diff} files in directory ${f}"
einfo "Applying patches from ${f} ..."
local f2
--
2.14.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2018-02-04 7:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-04 7:55 [gentoo-portage-dev] Fix Misc. Bash Errors in phase-helpers.sh R0b0t1
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox