[pacman-dev] [PATCH 1/3] rankmirrors: properly sort resulting times

Dave Reisner d at falconindy.com
Mon Sep 5 00:57:12 EDT 2011


- Properly read each sorted line into a new array, instead of breaking
  on every word.
- LC_COLLATE should apply to the sort portion of the pipeline, not the
  printing.

Signed-off-by: Dave Reisner <dreisner at archlinux.org>
---
 scripts/rankmirrors.sh.in |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/scripts/rankmirrors.sh.in b/scripts/rankmirrors.sh.in
index a0ff6d5..875a143 100644
--- a/scripts/rankmirrors.sh.in
+++ b/scripts/rankmirrors.sh.in
@@ -92,7 +92,8 @@ getfetchurl() {
 
 # This exists to remove the need for a separate interrupt function
 finaloutput() {
-	IFS=$'\n' sortedarray=( $(LC_COLLATE=C printf "%s\n" "${timesarray[@]}" | sort) )
+	IFS=$'\n' read -r -d '' -a sortedarray < \
+		<(printf '%s\n' "${timesarray[@]}" | LC_COLLATE=C sort)
 
 	# Final output for mirrorfile
 	numiterator="0"
-- 
1.7.6.1



More information about the pacman-dev mailing list