This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author sable
Recipients ajaksu2, loewis, mdr0, nnorwitz, r.david.murray, sable
Date 2010-09-22.09:58:44
SpamBayes Score 3.5366365e-06
Marked as misclassified No
Message-id <1285149526.51.0.345814893933.issue678264@psf.upfronthosting.co.za>
In-reply-to
Content
The ideal would be to check that RLIMIT_FSIZE corresponds to the ulimit as it has been suggested by Neal Norwitz in msg14345, but since the value reported by ulimit has a different unit for each platform, that would be quite a lot of trouble.

All I can suggest is the following, which checks that both values are somewhat reasonable.

Index: Lib/test/test_resource.py
===================================================================
--- Lib/test/test_resource.py	(révision 84964)
+++ Lib/test/test_resource.py	(copie de travail)
@@ -20,12 +20,17 @@
         except AttributeError:
             pass
         else:
-            # RLIMIT_FSIZE should be RLIM_INFINITY, which will be a really big
-            # number on a platform with large file support.  On these platforms,
-            # we need to test that the get/setrlimit functions properly convert
-            # the number to a C long long and that the conversion doesn't raise
-            # an error.
-            self.assertEqual(resource.RLIM_INFINITY, max)
+            # RLIMIT_FSIZE should be RLIM_INFINITY if 'ulimit -f' is
+            # set to unlimited
+            # RLIM_INFINITY will be a really big number on a platform
+            # with large file support.  On these platforms, we need to
+            # test that the get/setrlimit functions properly convert
+            # the number to a C long long and that the conversion
+            # doesn't raise an error.            
+            self.assertGreater(resource.RLIM_INFINITY, 0)
+            self.assertLessEqual(cur, max)
+            self.assertGreater(max, 0)
+            self.assertLessEqual(max, resource.RLIM_INFINITY)
             resource.setrlimit(resource.RLIMIT_FSIZE, (cur, max))
 
     def test_fsize_enforced(self):
History
Date User Action Args
2010-09-22 09:58:46sablesetrecipients: + sable, loewis, nnorwitz, mdr0, ajaksu2, r.david.murray
2010-09-22 09:58:46sablesetmessageid: <1285149526.51.0.345814893933.issue678264@psf.upfronthosting.co.za>
2010-09-22 09:58:44sablelinkissue678264 messages
2010-09-22 09:58:44sablecreate