From f56dede6f0d67b2435681a318bccb04d4f017fbd Mon Sep 17 00:00:00 2001 From: Dominic Dunlop Date: Tue, 8 Apr 1997 22:15:15 +0200 Subject: [PATCH] Accommodate CodeBuilder variant of Machten 4.0.3 The following patch against _97b massages a couple of test files so that CodeBuilder 1.0, a derivative of MachTen 4.0.3, passes all tests (except lib/db-recno, due to an old DB library). The patch does three things: 1. Make op/stat.t test 35 look in /usr/bin for SUID files iff $^O has value 'machten'. (PowerBuilder has /bin directory, but it contains no SUID files. Perl5 porters with reasonable memories may remember that the test got retargetted at /bin only in January. Sigh. A better fix than this quick hack is really required.) 2. Make op/stat.t test 39 check for value of $^O, succeeding if it's 'machten'. (PowerBuilder and other MachTen variants lack /MachTen directory, but all have a uname which says they're 'machten'.) 3. Amend io/fs.t test 25 so that it tests whether truncate can reduce the length of a file attached to a filehandle, mirroring test 23's check of whether truncate can reduce the length of a named file, rather than testing whether truncate can extend an empty file attched to a filehandle. (See discussion below.) NOTE IN PARTICULAR POINT 3: CodeBuilder is distinguished from MachTen 4.0.3 in supporting a true Berkeley Fast File System as an alternative to MacOS' incredibly slow Heirarchical File System. CodeBuilder's FFS code is derived from 4.3BSD, and does not allow truncate() to extend a file's size. The HFS code is derived from 4.4BSD, and does allow such extension. (The man page for truncate(2) has not, as far as I can tell, changed in a long time, and has reather slippery wording: it's not clear whether extension is allowed, and the system errors one might expect for failed extension -- ENOSPC and others -- are not mentioned.) Looking at the io/fs.t, it seems that a typo may have turned a check that the length of a file attached to a handle can be reduced into a check that it can be extended. The patch "fixes" the test to check for length reduction. If, on the other hand, it should indeed be a test of extension (which, presumably, every other system that supports truncate() passes) then io/fs.t should not be patched, and CodeBuilder 1.0 pronounced buggy. p5p-msgid: v03020902af704d320f27@[194.51.248.88] --- t/io/fs.t | 2 +- t/op/stat.t | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/t/io/fs.t b/t/io/fs.t index d83fe1a..53ba21a 100755 --- a/t/io/fs.t +++ b/t/io/fs.t @@ -117,7 +117,7 @@ else { truncate "Iofs.tmp", 0; if (-z "Iofs.tmp") {print "ok 24\n"} else {print "not ok 24\n"} `echo helloworld > Iofs.tmp`; - open(FH, ">Iofs.tmp") or die "Can't create Iofs.tmp"; + open(FH, ">>Iofs.tmp") or die "Can't create Iofs.tmp"; truncate FH, 5; if (-s "Iofs.tmp" == 5) {print "ok 25\n"} else {print "not ok 25\n"} truncate FH, 0; diff --git a/t/op/stat.t b/t/op/stat.t index 84c5283..c1cc157 100755 --- a/t/op/stat.t +++ b/t/op/stat.t @@ -1,8 +1,6 @@ #!./perl # $RCSfile: stat.t,v $$Revision: 4.1 $$Date: 92/08/07 18:28:28 $ -# 950521 DFD This version hacked to make test 39 succeed on MachTen -# though the O.S. wrongly thinks /dev/null is a terminal BEGIN { chdir 't' if -d 't'; @@ -141,7 +139,7 @@ if ($^O eq 'amigaos' or $Is_MSWin32) {print "ok 35\n"; goto tty_test;} $cnt = $uid = 0; die "Can't run op/stat.t test 35 without pwd working" unless $cwd; -($bin) = grep {-d} qw(/bin /usr/bin) +($bin) = grep {-d} ($^O eq 'machten' ? qw(/usr/bin /bin) : qw(/bin /usr/bin)) or print ("not ok 35\n"), goto tty_test; opendir BIN, $bin or die "Can't opendir $bin: $!"; while (defined($_ = readdir BIN)) { @@ -174,7 +172,7 @@ else { } if (! -t tty) {print "ok 38\n";} else {print "not ok 38\n";} open(null,"/dev/null"); -if (! -t null || -e '/xenix' || -e '/MachTen' || $Is_MSWin32) +if (! -t null || -e '/xenix' || $^O eq 'machten' || $Is_MSWin32) {print "ok 39\n";} else {print "not ok 39\n";} close(null); if (-t) {print "ok 40\n";} else {print "not ok 40\n";} -- 1.8.3.1