[arch-projects] [initscripts][PATCH] functions: avoid usage of tac

Dave Reisner d at falconindy.com
Wed Jan 11 20:12:44 EST 2012


tac stupidly writes to a tempfile when the input isn't seekable, which
is true in our case as it's reading from a pipe. Since the whole goal
here is to avoid using disk, build an array in reverse. For whatever
reason, Bash truly sucks at doing this from a execution time standpoint,
but that isn't really a concern here.

Signed-off-by: Dave Reisner <dreisner at archlinux.org>
---
 functions |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/functions b/functions
index 02852b8..b409055 100644
--- a/functions
+++ b/functions
@@ -497,8 +497,8 @@ umount_all() {
 			continue
 		fi
 
-		mounts+=("$target")
-	done < <(findmnt -mrunRo TARGET,FSTYPE,OPTIONS / | tac)
+		mounts=("$target" "${mounts[@]}")
+	done < <(findmnt -mrunRo TARGET,FSTYPE,OPTIONS /)
 
 	umount -r "${mounts[@]}"
 
-- 
1.7.8.3



More information about the arch-projects mailing list