don't catch and ignore EnvironmentError when trying to get disk stats #1516

Open
opened 2011-08-29 18:10:58 +00:00 by zooko · 0 comments

I would rather see things fail than report "available space == 0".

HACK zompu:~/playground/tahoe-lafs/what-393-called-trunk$ darcs diff -u src/allmydata/util/fileutil.py 
--- old-what-393-called-trunk/src/allmydata/util/fileutil.py    2011-08-29 12:06:41.597004643 -0600
+++ new-what-393-called-trunk/src/allmydata/util/fileutil.py    2011-08-29 12:06:41.612004695 -0600
@@ -415,6 +415,3 @@
         return get_disk_stats(whichdir, reserved_space)['avail']
     except AttributeError:
         return None
-    except EnvironmentError:
-        log.msg("OS call to get disk statistics failed")
-        return 0

I did encounter a case where this catch-and-return-0 was hiding the existence of a bug. It wasn't a bug in trunk, it was a bug in my working version, but still.

I would rather see things fail than report "available space == 0". ``` HACK zompu:~/playground/tahoe-lafs/what-393-called-trunk$ darcs diff -u src/allmydata/util/fileutil.py --- old-what-393-called-trunk/src/allmydata/util/fileutil.py 2011-08-29 12:06:41.597004643 -0600 +++ new-what-393-called-trunk/src/allmydata/util/fileutil.py 2011-08-29 12:06:41.612004695 -0600 @@ -415,6 +415,3 @@ return get_disk_stats(whichdir, reserved_space)['avail'] except AttributeError: return None - except EnvironmentError: - log.msg("OS call to get disk statistics failed") - return 0 ``` I did encounter a case where this catch-and-return-0 was hiding the existence of a bug. It wasn't a bug in trunk, it was a bug in my working version, but still.
zooko added the
code-storage
minor
defect
1.9.0a1
labels 2011-08-29 18:10:58 +00:00
zooko added this to the undecided milestone 2011-08-29 18:10:58 +00:00
tahoe-lafs modified the milestone from undecided to 1.10.0 2011-08-30 11:16:29 +00:00
tahoe-lafs modified the milestone from 1.11.0 to 1.10.0 2012-04-01 04:00:15 +00:00
tahoe-lafs modified the milestone from 1.10.0 to 1.11.0 2012-12-13 17:23:20 +00:00
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Reference: tahoe-lafs/trac-2024-07-25#1516
No description provided.