[Pkg-privacy-commits] [tails-installer] 08/35: Limit the overlay size to 3999MB for FAT32 (#619)

anonym anonym-tails-guest at moszumanska.debian.org
Thu Jan 12 15:14:41 UTC 2017


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

anonym-tails-guest pushed a commit to annotated tag 3.12.0
in repository tails-installer.

commit 1f54d997d0eb69390af232f38f7c6f9c56bfeaf1
Author: Luke Macken <lmacken at redhat.com>
Date:   Fri Mar 1 11:28:15 2013 -0500

    Limit the overlay size to 3999MB for FAT32 (#619)
---
 liveusb/gui.py | 36 ++++++++++++++++++++++++------------
 1 file changed, 24 insertions(+), 12 deletions(-)

diff --git a/liveusb/gui.py b/liveusb/gui.py
index eb6af73..b387d65 100755
--- a/liveusb/gui.py
+++ b/liveusb/gui.py
@@ -48,6 +48,9 @@ try:
 except:
     pass
 
+MAX_FAT16 = 2047
+MAX_FAT32 = 3999
+
 
 class LiveUSBApp(QtGui.QApplication):
     """ Main application class """
@@ -400,27 +403,36 @@ class LiveUSBDialog(QtGui.QDialog, LiveUSBInterface):
         freespace = device['free']
         current_overlay = self.overlaySlider.value()
 
+        if device['fsversion'] == 'FAT32':
+            self.live.log.warning(_('Partition is FAT32; Restricting overlay '
+                                    'size to 4G'))
+            max_space = MAX_FAT32
+        elif device['fsversion'] == 'FAT16':
+            self.live.log.warning(_('Partition is FAT16; Restricting overlay '
+                                    'size to 2G'))
+            max_space = MAX_FAT16
+        else:
+            max_space = freespace
+
         if not device['mount']:
             self.live.log.warning(_('Device is not yet mounted, so we cannot '
-                                    'determine the amount of free space.  '
-                                    'Setting a maximum limit of 8G for the '
-                                    'persistent storage.'))
-            freespace = 8192
+                                    'determine the amount of free space.'))
+            if freespace > max_space:
+                freespace = max_space
         else:
             if not freespace:
                 self.live.log.warning(_('No free space on %s') % drive)
                 freespace = 0
-
-        # FAT16 cannot handle files greater than 2G
-        if device['fsversion'] == 'FAT16':
-            self.live.log.warning(_('Partition is FAT16; Restricting overlay '
-                                    'size to 2G'))
-            if freespace > 2047:
-                freespace = 2047
+            else:
+                if device['fsversion'] in ('FAT32', 'FAT16'):
+                    if freespace > max_space:
+                        freespace = max_space
 
         # Subtract the size of the ISO from our maximum overlay size
         if self.live.isosize:
-            freespace -= self.live.isosize / 1024**2
+            iso_size = self.live.isosize / 1024**2
+            if freespace + iso_size > device['free']:
+                freespace -= iso_size
 
         freespace -= 1 # Don't fill the device 100%
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/tails-installer.git



More information about the Pkg-privacy-commits mailing list