[Tails-dev] Please review bugfix/fix_background_readahead

Delete this message

Reply to this message
Autore: Ague Mille
Data:  
To: tails-dev
Oggetto: [Tails-dev] Please review bugfix/fix_background_readahead
Hi!

While testing 0.13~rc1, I worked a bit on fixing the 'boot pause' issue
that is related to our readahead mechanism.

The patch looks simple enough to be a candidate for 0.13.



diff --git a/config/chroot_local-includes/lib/live/config/0000-readahead b/config/chroot_local-includes/lib/live/config/0000-readahead
index c29edbd..acc4782 100755
--- a/config/chroot_local-includes/lib/live/config/0000-readahead
+++ b/config/chroot_local-includes/lib/live/config/0000-readahead
@@ -24,22 +24,24 @@ Readahead ()

 Start_readahead ()
 {
-    FG_FILES="$(sed -n "\:$BACKGROUND_AT:q;p" "$READAHEAD_LIST")"
-    BG_FILES="$(sed -n "\:$BACKGROUND_AT:,\$p" "$READAHEAD_LIST")"
+    FG_FILES="sed -n '\:$BACKGROUND_AT:q;p' '$READAHEAD_LIST'"
+    BG_FILES="sed -n '\:$BACKGROUND_AT:,\$p' '$READAHEAD_LIST'"
     FG_SIZE=$(
      cd /
-     echo "$FG_FILES" |
+     "$FG_FILES" |
      xargs du -c 2>/dev/null |
      awk '$2 ~ /^total$/ { t = t + $1 } END { print t }')
     (cd /
-     echo "$BG_FILES" |
+     "$BG_FILES" |
      xargs stat >/dev/null 2>/dev/null || :)
     (cd /
-     echo "$FG_FILES" |
+     "$FG_FILES" |
      xargs cat 2>/dev/null |
      pv -f -s ${FG_SIZE}k >/dev/null || :)
     (cd /
-     echo "$BG_FILES" | xargs cat >/dev/null 2>&1 || :) &
+     start-stop-daemon \
+        --start --background --pid /var/run/background-readahead.pid --startas /bin/sh -- \
+        -c "$BG_FILES | xargs cat >/dev/null 2>&1")


     # Creating state file
     touch /var/lib/live/config/readahead




--
Ague