develooper Front page | perl.perl5.porters | Postings from March 2007

[PATCH] perl5db.t: skip test when /dev/tty is not available

Thread Next
From:
Alexey Tourbin
Date:
March 17, 2007 09:30
Subject:
[PATCH] perl5db.t: skip test when /dev/tty is not available
Message ID:
20070317162833.GA10670@solemn.turbinal
Hello,

For some reason, I happen to build perl in restricted environment
without /dev/tty.  Now perl5db.pl at least hangs, and at worst
is actively exhausting system resources.

The reason seems to be the following perl5db.pl code:

  1362	# As noted, this test really doesn't check accurately that the debugger
  1363	# is running at a terminal or not.
  1364
  1365	if ( -e "/dev/tty" ) {                      # this is the wrong metric!
  1366	    $rcfile = ".perldb";
  1367	}
  1368	else {
  1369	    $rcfile = "perldb.ini";
  1370	}

Furthermore, it is not enough to just write both .perldb and perldb.ini.
perl5db.pl has some more crippled code that drive things very wrong.

  1639	    else {
  1640
  1641	        # everything else is ...
  1642	        $console = "sys\$command";
  1643	    }

So, after my attempt to fix the problem by writing both .perldb and
perldb.ini, now I can see the t/sys$command file, and everything is
yet worse.

I think that the easiest way to address the prolem is, in perl5db.t,
to check for /dev/tty instead of /dev/null.
---
 lib/perl5db.t |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/perl5db.t b/lib/perl5db.t
index 9c95a5b..a6b0b1e 100644
--- a/lib/perl5db.t
+++ b/lib/perl5db.t
@@ -10,8 +10,8 @@ use strict;
 use warnings;
 
 BEGIN {
-    if (!-c "/dev/null") {
-	print "1..0 # Skip: no /dev/null\n";
+    if (!-c "/dev/tty") {
+	print "1..0 # Skip: no /dev/tty\n";
 	exit 0;
     }
 }
-- 
1.5.0.2.GIT


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About