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.

classification
Title: Add check for setrlimit() support
Type: Stage:
Components: Tests Versions: Python 2.3
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: jlt63 Nosy List: gsw_agere, jlt63, loewis
Priority: normal Keywords: patch

Created on 2002-05-03 18:18 by gsw_agere, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
test_resource.py.patch gsw_agere, 2002-05-03 18:19
test_resource.py.patch gsw_agere, 2002-05-06 13:11 Revised to check for error return instead
Messages (9)
msg39833 - (view) Author: Gerald S. Williams (gsw_agere) Date: 2002-05-03 18:18
The new test_resource test calls resource.setrlimit() 
to change the file size limits. This fails on Cygwin, 
which supports setrlimit() and getrlimit(), just not 
changing that particular setting. (The same would 
apply to any other platforms that has those functions 
but not that particular feature.)

Since that getrlimit() works, and setrlimit() can be 
used for other reasons, a check for sys.platform was 
added to that part of the test.
msg39834 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2002-05-06 08:44
Logged In: YES 
user_id=21627

Don't check for systems, check for features instead.

In this specific case, what error does Cygwin report? Could
that be used to deal with the missing feature in a more
general way?
msg39835 - (view) Author: Gerald S. Williams (gsw_agere) Date: 2002-05-06 13:11
Logged In: YES 
user_id=329402

Cygwin Python raises ValueError when you call setrlimit() 
for RLIMIT_FSIZE. That limit is hardcoded at infinity and 
cannot be changed. I have submitted an alternative patch 
that looks for ValueError rather than checking sys.platform.
msg39836 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2002-06-02 17:53
Logged In: YES 
user_id=21627

I'm not sure I understand the logic in the modified
setrlimit(FSIZE) case. If setting the limit fails, it seems
that the entire test should be skipped. Raising TestSkipped
might be appropriate, to indicate that the result of the
test is not trustworthy.
msg39837 - (view) Author: Gerald S. Williams (gsw_agere) Date: 2002-06-03 12:44
Logged In: YES 
user_id=329402

Since there are other limits that can be set via setrlimit(), 
failing the entire test due to a limitation on setrlimit(FSIZE) 
did not seem appropriate (even though this is currently the 
only resource limit that is tested).

Besides, even though setrlimit(FSIZE) isn't allowed to change 
the value, it should still be able to set it to the values returned 
via getrlimit(), and should still report ValueError for extremely 
large values for either cur or max. So the test is meaningful 
even on systems that aren't allowed to lower the FSIZE limit.
msg39838 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2002-12-04 10:26
Logged In: YES 
user_id=21627

Jason, can you please review this patch, and apply it if it 
looks ok?

If not, please unassign it.
msg39839 - (view) Author: Jason Tishler (jlt63) * (Python triager) Date: 2002-12-12 17:43
Logged In: YES 
user_id=86216

The patch looks OK from a Cygwin point of view. However,
I'm not very knowledgeable in this area. Still OK to apply?
msg39840 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2002-12-12 17:51
Logged In: YES 
user_id=21627

If "looks ok" means "the test fails without the patch, and
passes with the patch", then go ahead and apply it.
msg39841 - (view) Author: Jason Tishler (jlt63) * (Python triager) Date: 2002-12-12 18:14
Logged In: YES 
user_id=86216

Checked in as Lib/test/test_resource.py 1.3.
History
Date User Action Args
2022-04-10 16:05:17adminsetgithub: 36547
2002-05-03 18:18:19gsw_agerecreate