Fails to calculate free space for long mount points

Bug #185497 reported by Brett Sealey
22
Affects Status Importance Assigned to Milestone
easycrypt (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: easycrypt

easycrypt Version: 0.2.2.5-0ubuntu1
installed onto a standard gutsy system with latest truecrypt installed
My home directory is nfs mounted.

When trying to create a crypt in my home directory it gave the following output:
username@hostname[32116]% easycrypt
failed to load localised text, defaulting to English (en)
Easy Crypt 0.2.2.5 (2008/01/23 22:34:45)
root is /usr/share/easycrypt
home is /home/username/
first run show them the welcome
sudo command will be gksudo
checking : ps -ef | grep "pyt[h]on ./EasyCrypt.py"
looking for truecrypt
found truecrypt
df -k /home/user/ | tail -1 | awk {'print $4'}
size left 99%
Traceback (most recent call last):
  File "./EasyCrypt.py", line 1504, in doFirstCreateEvent
    self.getCryptPasswordThenAction("create")
  File "./EasyCrypt.py", line 872, in getCryptPasswordThenAction
    spaceleft = self.howMuchSpaceInKb()
  File "./EasyCrypt.py", line 408, in howMuchSpaceInKb
    return int(checkAmountLeft)
ValueError: invalid literal for int() with base 10: '99%'

This is caused by df using two lines to display long mounted filesystem names.

e.g.
% df -k ~
Filesystem 1K-blocks Used Available Use% Mounted on
fileserver:/home/username
                      21165056 20751360 413696 99% /home/username

A solution is to patch /usr/share/easycrypt/EasyCrypt.py to use df's -P (posix compatibility) flag.

e.g.
% df -Pk ~
Filesystem 1024-blocks Used Available Capacity Mounted on
fileserver:/home/username 21165056 20751360 413696 99% /home/username

Patch:
% diff -u /usr/share/easycrypt/EasyCrypt.py-dist /usr/share/easycrypt/EasyCrypt.py
--- /usr/share/easycrypt/EasyCrypt.py-dist 2008-01-23 23:07:10.000000000 +0000
+++ /usr/share/easycrypt/EasyCrypt.py 2008-01-23 22:43:15.000000000 +0000
@@ -393,8 +393,8 @@
                        print "max size is 2000"
                        capMax = True

- print "df -k "+self.workingFolder+" | tail -1 | awk {'print $4'}"
- checkAmountLeft = commands.getoutput("df -k "+self.workingFolder+" | tail -1 | awk {'print $4'}")
+ print "df -Pk "+self.workingFolder+" | tail -1 | awk {'print $4'}"
+ checkAmountLeft = commands.getoutput("df -Pk "+self.workingFolder+" | tail -1 | awk {'print $4'}")
                print "size left", checkAmountLeft

                if capMax:

Related branches

Revision history for this message
Steven Harper (stevenharperuk) wrote :

Thanks - I will add this patch to Version 0.2.2.6

Changed in easycrypt:
status: New → Confirmed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package easycrypt - 0.2.2.6-0ubuntu1

---------------
easycrypt (0.2.2.6-0ubuntu1) hardy; urgency=low

  * New Upstream Version (LP: #188465)
  * Fixed Bug calculating free space (LP: #185497)
  * Added Danish Language
  * Added Greek Language

 -- Steven Harper <email address hidden> Sat, 2 Feb 2008 09:52:00 +0100

Changed in easycrypt:
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.