1 message in org.python.python-bugs-list[ python-Bugs-678264 ] test_resource ...
FromSent OnAttachments
SourceForge.netMar 10, 2004 12:26 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:[ python-Bugs-678264 ] test_resource fails when file size is limitedActions...
From:SourceForge.net (nore@sourceforge.net)
Date:Mar 10, 2004 12:26:08 pm
List:org.python.python-bugs-list

Bugs item #678264, was opened at 2003-01-31 12:06 Message generated for change (Comment added) made by mdr0 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=678264&group_id=5470

Category: Python Library Group: None Status: Open Resolution: None Priority: 5 Submitted By: Neal Norwitz (nnorwitz) Assigned to: Neal Norwitz (nnorwitz) Summary: test_resource fails when file size is limited

Initial Comment: test_resource does:

print resource.RLIM_INFINITY == max

I'm not sure of the benefit of this line. For machines which have limited file sizes, it causes the test to fail. Otherwise the test seems to work properly.

----------------------------------------------------------------------

Comment By: Mark D. Roth (mdr0) Date: 2004-03-10 11:26

Message: Logged In: YES user_id=994239

I'm running into this problem under AIX 4.3.3 and 5.1. Is this going to cause a problem if I put python into production, or is it "safe" to ignore it?

----------------------------------------------------------------------

Comment By: Martin v. L?wis (loewis) Date: 2003-03-30 14:49

Message: Logged In: YES user_id=21627

I'm really not that much concerned about fixing the test, but more about fixing the code itself.

----------------------------------------------------------------------

Comment By: Neal Norwitz (nnorwitz) Date: 2003-03-30 14:25

Message: Logged In: YES user_id=33168

Hmmm, sounds like a lot of work. How about something like this:

expected_max = resource.RLIM_INFINITY if expected_max != max: # read the file resource limit fsize_ulimit = os.popen('ulimit -f').read() try: # convert the file size to bytes (from 512 byte blocks) expected_max = int(fsize_ulimit.strip()) * 512 except ValueError: raise TestSkipped, "unable to determine expected resource value" print expected_max == max

This works, but I'm pretty sure this is not portable. On Linux blocks are 1k. This only works when the block size is 512 bytes. Shall we close this bug as a test environment problem and won't fix?

----------------------------------------------------------------------

Comment By: Martin v. L?wis (loewis) Date: 2003-03-30 10:15

Message: Logged In: YES user_id=21627

The rationale of the line is explained in the comment: The code tests whether the limit is a really large number, i.e. whether represenation of large limits works.

Unfortunately, it doesn't (which is a separate issue): On Linux, RLIM_INFINITY is reported as -1. This comes from RLIM_INFINITY being the larges unsigned long long number, i.e. 0xffffffffffffffffuLL. The resource module represents this incorrectly.

I think there is no way to verify that Python computes the real limit correctly (unless we invoke the shell's ulimit for comparison). So you could weaken the test to verify that the limit is non-negative (and, as a side effect, verify that it doesn't raise an exception).

If you do so, you'll also have to fix the implementation, so that the weakened-strengthened test passes on Linux.

----------------------------------------------------------------------

Comment By: Neal Norwitz (nnorwitz) Date: 2003-03-03 16:17

Message: Logged In: YES user_id=33168

Martin, welcome back! Now I get to assign some bugs to you to see if you have any input. :-)

----------------------------------------------------------------------