GNU bug report logs - #6655
[PATCH] tests/misc/sort-merge-fdlimit: don't assume -R opens /dev/urandom

Previous Next

Package: coreutils;

Reported by: Paul Eggert <eggert <at> CS.UCLA.EDU>

Date: Fri, 16 Jul 2010 18:32:01 UTC

Severity: normal

Tags: patch

Done: Jim Meyering <jim <at> meyering.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 6655 in the body.
You can then email your comments to 6655 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#6655; Package coreutils. (Fri, 16 Jul 2010 18:32:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Paul Eggert <eggert <at> CS.UCLA.EDU>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Fri, 16 Jul 2010 18:32:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> CS.UCLA.EDU>
To: Bug Coreutils <bug-coreutils <at> gnu.org>
Subject: [PATCH] tests/misc/sort-merge-fdlimit: don't assume -R opens
	/dev/urandom
Date: Fri, 16 Jul 2010 11:31:33 -0700
While reviewing the recent sort patches I discovered something
else that needed to be merged.  One test in the patch assumes that
sort -R opens /dev/urandom, and makes sure that file descriptor
exhaustion doesn't occur.  But sort -R no longer opens /dev/urandom
by default, so the test doesn't actually test for the bug that it
was designed for (and the test will succeed even if the bug was
present).  I installed this to resurrect the test.

From 9e89f39526999c6eef0a0d0211eaa1804e62a628 Mon Sep 17 00:00:00 2001
From: Paul R. Eggert <eggert <at> cs.ucla.edu>
Date: Fri, 16 Jul 2010 11:27:42 -0700
Subject: [PATCH] tests/misc/sort-merge-fdlimit: don't assume -R opens /dev/urandom

* tests/misc/sort-merge-fdlimit: This test was written assuming that
-R typically opens /dev/urandom, but that's no longer the case.
Redo test to specify a random source; this resurrects the point of
checking for file descriptor exhaustion.  Also try plain -R, since
that implementation may change in the future too.
---
 tests/misc/sort-merge-fdlimit |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/tests/misc/sort-merge-fdlimit b/tests/misc/sort-merge-fdlimit
index d1736f5..56b8518 100755
--- a/tests/misc/sort-merge-fdlimit
+++ b/tests/misc/sort-merge-fdlimit
@@ -31,6 +31,7 @@ mkdir in err || framework_failure
 for i in `seq 17`; do
   echo $i >in/$i
 done
+seq 17 >some-data
 
 # When these tests are run inside the automated testing framework, they
 # have one less available file descriptor than when run outside the
@@ -43,11 +44,14 @@ done
    && sort -m --batch-size=16 in/* 2>err/merge-default-err \
    || ! grep "open failed" err/merge-default-err) || fail=1
 
-# If sort opens a file (/dev/urandom) to sort by random hashes of keys,
+# If sort opens a file to sort by random hashes of keys,
 # it needs to consider this file against its limit on open file
-# descriptors.
-(ulimit -n 20 \
-   && sort -mR --batch-size=16 in/* 2>err/merge-random-err \
-   || ! grep "open failed" err/merge-random-err) || fail=1
+# descriptors.  Test once with the default random source
+# and once with an explicit source.
+for randsource in '' --random-source=some-data; do
+  (ulimit -n 20 \
+     && sort -mR $randsource --batch-size=16 in/* 2>err/merge-random-err \
+     || ! grep "open failed" err/merge-random-err) || fail=1
+done
 
 Exit $fail
-- 
1.7.1





Information forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#6655; Package coreutils. (Sat, 24 Jul 2010 06:50:03 GMT) Full text and rfc822 format available.

Message #8 received at 6655 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> CS.UCLA.EDU>
To: 6655 <at> debbugs.gnu.org
Subject: Re: [PATCH] tests/misc/sort-merge-fdlimit: don't assume -R opens
	/dev/urandom
Date: Fri, 23 Jul 2010 23:49:24 -0700
On 07/16/10 11:31, Paul Eggert wrote:
> I installed this to resurrect the test.

Ooops; forgot to push that.  Sorry.  Just did it now.




Information forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#6655; Package coreutils. (Sat, 24 Jul 2010 07:25:02 GMT) Full text and rfc822 format available.

Message #11 received at 6655 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> CS.UCLA.EDU>
To: Bug Coreutils <bug-coreutils <at> gnu.org>
Cc: 6655 <at> debbugs.gnu.org
Subject: Re: [PATCH] du: tune, and fix some -L bugs with dangling or cyclic
	symlinks
Date: Sat, 24 Jul 2010 00:24:07 -0700
No further comment, and that patch does fix some real bugs
and seems to be pretty safe, so I took the liberty of pushing it.




bug closed, send any further explanations to 6655 <at> debbugs.gnu.org and Paul Eggert <eggert <at> CS.UCLA.EDU> Request was from Jim Meyering <jim <at> meyering.net> to control <at> debbugs.gnu.org. (Tue, 19 Apr 2011 07:15:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 17 May 2011 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 14 years and 100 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.