[X2Go-Commits] [x2goclient] 63/179: deduplicate.sh: quote "${arr[@]}" correctly to not suddenly force word splitting.

git-admin at x2go.org git-admin at x2go.org
Mon Jun 20 23:55:11 CEST 2016


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch bugfix/osx
in repository x2goclient.

commit 57c1851cf0b4e236d9cc32d0d12b6902da782444
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Thu Aug 27 04:51:07 2015 +0200

    deduplicate.sh: quote "${arr[@]}" correctly to not suddenly force word splitting.
---
 debian/changelog |    2 ++
 deduplicate.sh   |   22 +++++++++++-----------
 2 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 3771adf..6e3a774 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -141,6 +141,8 @@ x2goclient (4.0.5.2-0x2go1) UNRELEASED; urgency=medium
     - deduplicate.sh: correctly unset an array element.
     - deduplicate.sh: change range-based for loops to "${!arr[@]}" to handle
       "sparse" arrays correctly.
+    - deduplicate.sh: quote "${arr[@]}" correctly to not suddenly force word
+      splitting.
   * debian/control:
     - Maintainer change in package: X2Go Developers <x2go-dev at lists.x2go.org>.
 
diff --git a/deduplicate.sh b/deduplicate.sh
index d932fbb..33c4628 100755
--- a/deduplicate.sh
+++ b/deduplicate.sh
@@ -40,7 +40,7 @@ while read -r -d '' entry; do
 done < <(find "${base_dir}" -type 'f' -print0)
 
 typeset -a top_files
-for entry in ${all_files[@]}; do
+for entry in "${all_files[@]}"; do
 	typeset relative_path="${entry##"${base_dir}/"}"
 	typeset tmp_regex='^[^/]+$'
 	if [[ "${relative_path}" =~ ${tmp_regex} ]]; then
@@ -50,11 +50,11 @@ for entry in ${all_files[@]}; do
 done
 
 typeset -a duplicates
-for entry in ${all_files[@]}; do
+for entry in "${all_files[@]}"; do
 	typeset relative_path="${entry##"${base_dir}/"}"
 	typeset file_name="$(basename "${entry}")"
 	typeset top_entry=""
-	for top_entry in ${top_files[@]}; do
+	for top_entry in "${top_files[@]}"; do
 		if [ "${top_entry}" != "${relative_path}" ]; then
 			if [ "${file_name}" = "${top_entry}" ]; then
 				echo "Adding duplicate: ${relative_path}"
@@ -65,7 +65,7 @@ for entry in ${all_files[@]}; do
 done
 
 echo "duplicates array before:"
-for entry in ${duplicates[@]}; do
+for entry in "${duplicates[@]}"; do
 	echo "${entry}"
 done
 
@@ -73,7 +73,7 @@ typeset -i i="0"
 for i in "${!duplicates[@]}"; do
 	entry="${duplicates[${i}]}"
 	typeset special_file_regex=""
-	for special_file_regex in ${special_files_regex[@]}; do
+	for special_file_regex in "${special_files_regex[@]}"; do
 		typeset tmp_regex='^'"${special_file_regex}"'$'
 		if [[ "${entry}" =~ ${tmp_regex} ]]; then
 			echo "mv \"${base_dir}/$(basename "${entry}")\" \"${base_dir}/$(dirname "${special_file_regex}")/\""
@@ -84,11 +84,11 @@ for i in "${!duplicates[@]}"; do
 done
 
 echo "duplicates array after:"
-for entry in ${duplicates[@]}; do
+for entry in "${duplicates[@]}"; do
 	echo "${entry}"
 done
 
-for entry in ${duplicates[@]}; do
+for entry in "${duplicates[@]}"; do
 	echo "rm -v ${base_dir}/${entry}"
 	typeset -i i="0"
 	for i in "${!all_files[@]}"; do
@@ -101,18 +101,18 @@ for entry in ${duplicates[@]}; do
 done
 
 echo "New value for all_files:"
-for entry in ${all_files[@]}; do
+for entry in "${all_files[@]}"; do
 	echo "${entry}"
 done
 
 echo "Duplicates-to-real map:"
 # Build complementary array to duplicates.
 typeset -a to_files
-for entry in ${duplicates[@]}; do
+for entry in "${duplicates[@]}"; do
 	typeset filename="$(basename "${entry}")"
 
 	typeset all_entry=""
-	for all_entry in ${all_files[@]}; do
+	for all_entry in "${all_files[@]}"; do
 		typeset all_entry_filename="$(basename "${all_entry}")"
 
 		if [ -n "${filename}" ] && [ -n "${all_entry_filename}" ]; then
@@ -135,7 +135,7 @@ for entry in ${duplicates[@]}; do
 done
 
 # Try to fixup files broken by duplicates removal.
-for all_entry in ${all_files[@]}; do
+for all_entry in "${all_files[@]}"; do
 	typeset otool_out="$(otool -L "${all_entry}")"
 
 	typeset dependencies="$(parse_otool_output "${otool_out}")"

--
Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git


More information about the x2go-commits mailing list