diff options
author | Seemant Kulleen <seemant@gentoo.org> | 2003-03-11 21:11:49 +0000 |
---|---|---|
committer | Seemant Kulleen <seemant@gentoo.org> | 2003-03-11 21:11:49 +0000 |
commit | f68541f7823c5f01a1d17215138989a709a5bab8 (patch) | |
tree | c22bc1b210b8aa9a93c59b71ddad228d4b5689d8 /dev-lang/perl/files | |
parent | unmasked in x86 (diff) | |
download | gentoo-2-f68541f7823c5f01a1d17215138989a709a5bab8.tar.gz gentoo-2-f68541f7823c5f01a1d17215138989a709a5bab8.tar.bz2 gentoo-2-f68541f7823c5f01a1d17215138989a709a5bab8.zip |
moved perl from sys-devel to dev-lang
Diffstat (limited to 'dev-lang/perl/files')
-rw-r--r-- | dev-lang/perl/files/5.6.1-builtin-fixup.diff | 22 | ||||
-rw-r--r-- | dev-lang/perl/files/5.6.1-op-test-fix.diff | 11 | ||||
-rw-r--r-- | dev-lang/perl/files/digest-perl-5.6.1-r10 | 1 | ||||
-rw-r--r-- | dev-lang/perl/files/digest-perl-5.6.1-r11 | 1 | ||||
-rw-r--r-- | dev-lang/perl/files/digest-perl-5.8.0-r10 | 1 | ||||
-rw-r--r-- | dev-lang/perl/files/digest-perl-5.8.0-r9 | 1 | ||||
-rw-r--r-- | dev-lang/perl/files/libperl-5.8.0-create-libperl-soname.patch | 12 | ||||
-rw-r--r-- | dev-lang/perl/files/libperl_rebuilder | 336 | ||||
-rw-r--r-- | dev-lang/perl/files/perl-5.8.0-RC2-special-h2ph-not-failing-on-machine_ansi_header.patch | 11 | ||||
-rw-r--r-- | dev-lang/perl/files/perl-5.8.0-perldoc-emptydirs.patch | 10 | ||||
-rw-r--r-- | dev-lang/perl/files/perl-5.8.0-prelink-lpthread.patch | 11 | ||||
-rw-r--r-- | dev-lang/perl/files/perl-5.8.0-sockatmark-should-__THROW.patch | 12 | ||||
-rw-r--r-- | dev-lang/perl/files/stat.t | 289 |
13 files changed, 718 insertions, 0 deletions
diff --git a/dev-lang/perl/files/5.6.1-builtin-fixup.diff b/dev-lang/perl/files/5.6.1-builtin-fixup.diff new file mode 100644 index 000000000000..a1f0735dda2a --- /dev/null +++ b/dev-lang/perl/files/5.6.1-builtin-fixup.diff @@ -0,0 +1,22 @@ +diff -Naur perl-5.6.1.orig/makedepend.SH perl-5.6.1/makedepend.SH +--- perl-5.6.1.orig/makedepend.SH 2001-03-19 07:33:17.000000000 +0000 ++++ perl-5.6.1/makedepend.SH 2002-05-27 02:27:08.000000000 +0000 +@@ -141,6 +141,8 @@ + $cppstdin $finc -I. $cppflags $cppminus <UU/$file.c | + $sed \ + -e '/^#.*<stdin>/d' \ ++ -e '/^#.*<built-in>/d' \ ++ -e '/^#.*<command line>/d' \ + -e '/^#.*"-"/d' \ + -e 's#\.[0-9][0-9]*\.c#'"$file.c#" \ + -e 's/^[ ]*#[ ]*line/#/' \ +@@ -155,6 +157,8 @@ + $sed \ + -e '1d' \ + -e '/^#.*<stdin>/d' \ ++ -e '/^#.*<built-in>/d' \ ++ -e '/^#.*<command line>/d' \ + -e '/^#.*"-"/d' \ + -e 's#\.[0-9][0-9]*\.c#'"$file.c#" \ + -e 's/^[ ]*#[ ]*line/#/' \ + diff --git a/dev-lang/perl/files/5.6.1-op-test-fix.diff b/dev-lang/perl/files/5.6.1-op-test-fix.diff new file mode 100644 index 000000000000..ab22b07b65b4 --- /dev/null +++ b/dev-lang/perl/files/5.6.1-op-test-fix.diff @@ -0,0 +1,11 @@ +--- t/op/stat.t.orig 2003-02-14 18:38:23.000000000 +0000 ++++ t/op/stat.t 2003-02-14 18:39:34.000000000 +0000 +@@ -180,7 +180,7 @@ + die "Can't run op/stat.t test 35 without pwd working" unless $cwd; + my @bin = grep {-d} ($^O eq 'machten' ? + qw(/usr/bin /bin) : +- qw(/sbin /usr/sbin /bin /usr/bin)); ++ qw(/sbin /usr/sbin /bin /usr/bin /usr/lib/misc)); + unless (@bin) { print ("not ok 35\n"), goto tty_test; } + for my $bin (@bin) { + opendir BIN, $bin or die "Can't opendir $bin: $!"; diff --git a/dev-lang/perl/files/digest-perl-5.6.1-r10 b/dev-lang/perl/files/digest-perl-5.6.1-r10 new file mode 100644 index 000000000000..a1b30f92f979 --- /dev/null +++ b/dev-lang/perl/files/digest-perl-5.6.1-r10 @@ -0,0 +1 @@ +MD5 ec1ff15464809b562aecfaa2e65edba6 perl-5.6.1.tar.gz 5983695 diff --git a/dev-lang/perl/files/digest-perl-5.6.1-r11 b/dev-lang/perl/files/digest-perl-5.6.1-r11 new file mode 100644 index 000000000000..a1b30f92f979 --- /dev/null +++ b/dev-lang/perl/files/digest-perl-5.6.1-r11 @@ -0,0 +1 @@ +MD5 ec1ff15464809b562aecfaa2e65edba6 perl-5.6.1.tar.gz 5983695 diff --git a/dev-lang/perl/files/digest-perl-5.8.0-r10 b/dev-lang/perl/files/digest-perl-5.8.0-r10 new file mode 100644 index 000000000000..517f2bed79ae --- /dev/null +++ b/dev-lang/perl/files/digest-perl-5.8.0-r10 @@ -0,0 +1 @@ +MD5 d9bdb180620306023fd35901a2878b62 perl-5.8.0.tar.gz 11023084 diff --git a/dev-lang/perl/files/digest-perl-5.8.0-r9 b/dev-lang/perl/files/digest-perl-5.8.0-r9 new file mode 100644 index 000000000000..517f2bed79ae --- /dev/null +++ b/dev-lang/perl/files/digest-perl-5.8.0-r9 @@ -0,0 +1 @@ +MD5 d9bdb180620306023fd35901a2878b62 perl-5.8.0.tar.gz 11023084 diff --git a/dev-lang/perl/files/libperl-5.8.0-create-libperl-soname.patch b/dev-lang/perl/files/libperl-5.8.0-create-libperl-soname.patch new file mode 100644 index 000000000000..f68fb8cc9ce8 --- /dev/null +++ b/dev-lang/perl/files/libperl-5.8.0-create-libperl-soname.patch @@ -0,0 +1,12 @@ +--- perl-5.8.0/Makefile.SH.orig 2002-12-28 07:46:27.000000000 +0200 ++++ perl-5.8.0/Makefile.SH 2002-06-09 19:04:06.000000000 +0200 +@@ -480,7 +480,7 @@ + case "$useshrplib" in + true) + $spitshell >>Makefile <<'!NO!SUBS!' +- $(LD) -o $@ $(SHRPLDFLAGS) perl$(OBJ_EXT) $(obj) ++ $(LD) -o $@ $(SHRPLDFLAGS) perl$(OBJ_EXT) $(obj) -Wl,-soname -Wl,libperl.so.`echo $(LIBPERL) | cut -d. -f3` + !NO!SUBS! + case "$osname" in + aix) + diff --git a/dev-lang/perl/files/libperl_rebuilder b/dev-lang/perl/files/libperl_rebuilder new file mode 100644 index 000000000000..6705a5784bbe --- /dev/null +++ b/dev-lang/perl/files/libperl_rebuilder @@ -0,0 +1,336 @@ +#!/bin/bash + +LOG=/tmp/perl-update.log + +echo "The script will attempt to re-emerge your perl modules, any packages" +echo "that compiled against libperl.so previously, as well as any packages" +echo "that placed files in /usr/lib/perl*. A log of its attempts, work, and" +echo "even failures is kept in ${LOG} - please refer to this log should you" +echo "experience any difficulties." + + +echo "--------------------------------------------------------------" >> $LOG +echo "--------------------------------------------------------------" >> $LOG +echo "--------------------------------------------------------------" >> $LOG + + +echo 'Finding what perl modules you have installed...' +echo 'Finding what perl modules you have installed...' >> $LOG + + +cd /var/db/pkg/dev-perl +PRE_MODULE_LIST=` + for i in $(ls -1| sort | uniq) + do + echo "dev-perl/${i}" + done | sed 's/-[0-9].*//g' | sort -u ` + + + +echo "Preliminary Module List: $PRE_MODULE_LIST" +echo "Preliminary Module List: $PRE_MODULE_LIST" >> $LOG + +#First, we clean up the perl module list - this is to avoid ambiguities later +echo "Cleaning Module List..." +echo "Cleaning Module List..." >> $LOG + + +for MODULE in $PRE_MODULE_LIST; +do + env-update + echo "Cleaning $MODULE" + echo "Cleaning $MODULE" >> $LOG + emerge -cp ${MODULE} 2>&1 | tee -a $LOG + emerge -c ${MODULE} +done + +echo 'Rechecking what perl modules you have installed...' +echo 'Rechecking what perl modules you have installed...' >> $LOG + + +SECOND_MODULE_LIST=` + for i in $(ls -1| sort -u) + do + echo "dev-perl/${i}" + done | sed 's/-[0-9].*//g' | sort -u` + + + +x=0 +while [ $x -lt 3 ] ; do +let "x++" +for MODULE in $SECOND_MODULE_LIST; + do + env-update + echo "Rebuilding: $MODULE, pass ${x}" + echo "Rebuilding: $MODULE, pass ${x}" >> $LOG + if ! emerge "$MODULE"; then + echo "emerge $MODULE FAILED while in rebuild, pass ${x}." + echo "emerge $MODULE FAILED while in rebuild, pass ${x}." >> $LOG + + else + echo "Done with $MODULE, pass ${x}" + echo "Done with $MODULE, pass ${x}" >> $LOG + + + fi + done + +done + +echo 'Preliminary Module Rebuild Complete. Now for rebuilding the rest...' +echo 'Preliminary Module Rebuild Complete. Now for rebuilding the rest...' >> $LOG + +#This time around, we want the explicit package name, since in the group remerge, we use +# a --oneshot =package syntax +MODULE_LIST=` + for i in $(ls -1| sort -u) + do + echo "dev-perl/${i}" + done | sort -u` + + +echo 'Finding broken packages...' +echo 'Finding broken packages...' >> $LOG +unset USE +REBUILD_FAKED="" + +env-update + +# Note: `` == $() +# REBUILD EXACTLY AS ON DISK. emerge =cat/package-version-rev +LDD_LIST=` +for i in $(find $(egrep -v ^# /etc/ld.so.conf) -type f -name '*.so*') \ + $(find $(echo $PATH | sed 's/:/ /g') -type f -perm +0111); +do + ldd ${i} 2>&1 | grep "libperl" - >/dev/null && qpkg -f -nc -v $i; +done | sort -u` +ORIGINAL_LIST="$LDD_LIST" + +if [ ! -z "$LDD_LIST" ]; then + REBUILD_PRELIST=` + echo $LDD_LIST | sed 's:\([^ ]\+\):=\1:g' | xargs emerge -p | + grep ebuild | sed 's:.*\] \([^ ]*\) .*:\1:'` +fi + +# The following is to grab any packages that have placed files in +# /usr/lib/perl* - this may include packages that are not explicityly +# perl modules in dev-perl, or that did not compile against our old +# libperl - this is a sanity check among other things + +cd /var/db/pkg +LIBS_LIST=`grep -ls "usr\/lib\/perl" */*/CONTENTS | sed 's|/CONTENTS||g' | grep -v "sys-devel/perl" | grep -v "dev-perl"` + +REBUILD_LIST=`echo ${LIBS_LIST} ${REBUILD_PRELIST} | sort -u` + +if echo $REBUILD_LIST | egrep -q "no.*ebuilds to satisfy"; then + echo "Packages are installed that no longer exist in Gentoo." + echo "Determine what you need to do to fix this and try again." + echo "The package may have been moved to a different category." + echo + echo "Easiest course of action: unmerge these by explicit versions" + echo "and re-emerge them if they still exist." + echo 'emerge -C \=package-version' + echo "Notice: $REBUILD_LIST" + exit 1 +fi + +if echo $REBUILD_LIST | grep -q "have been masked"; then + echo "Masked packages are installed and need to be rebuilt..." + echo "Either unmask them, or emerge -C them all." + echo + echo "Easiest course of action: unmerge these by explicit versions" + echo 'emerge -C \=package-version' + echo "Notice: $REBUILD_LIST" + exit 1 +fi + +echo "Preliminary List: $REBUILD_LIST" +echo "Preliminary List: $REBUILD_LIST" >> $LOG + +sleep 10s + +if ! emerge -p $(echo "$REBUILD_LIST" | sed 's:\([^ ]\+\):=\1:g') &>/dev/null; #' +then + # System isn't up to date, or nothing here to do... + if [ ! -z "$LDD_LIST" ]; then + REBUILD_LIST=` + echo $LDD_LIST | sed 's:\([^ ]\+\):>=\1:g' | xargs emerge -p | + grep ebuild | sed 's:.*\] \([^ ]\+\) .*:\1:'` + fi +fi + + + + +echo -e "Rebuild list:\n$REBUILD_LIST" +echo -e "Rebuild list:\n$REBUILD_LIST" >> $LOG + +sleep 20s + +if echo $REBUILD_LIST | egrep -q "no.*ebuilds to satisfy"; then + echo "Packages are installed that no longer exist in Gentoo." + echo "Determine what you need to do to fix this and try again." + echo "The package may have been moved to a different category." + echo + echo "Easiest course of action: unmerge these by explicit versions" + echo "and re-emerge them if they still exist." + echo 'emerge -C \=package-version' + echo "Notice: $REBUILD_LIST" + exit 1 +fi + +if echo $REBUILD_LIST | grep -q "have been masked"; then + echo "Masked packages are installed and need to be rebuilt..." + echo "Either unmask them, or emerge -C them all." + echo + echo "Easiest course of action: check your ACCEPT_KEYWORDS in make.conf" + echo 'emerge -C \=package-version' + echo "Notice: $REBUILD_LIST" + exit 1 +fi + +# I'm commenting out the next block. I don't think that this is necessary for the +# perl upgrade the same way it was for the gcc upgrade - MPC +#echo "Backing up the world file." +#cp /var/cache/edb/world /var/cache/edb/world.update_system_backup +# +# +#echo "Unmerging broken packages..." +#emerge -Cp $ORIGINAL_LIST | tee -a $LOG +#if ! emerge -C $ORIGINAL_LIST; then +# echo +# echo "There was a problem unmerging the broken packages." +# echo "Please pass on your log file to a Gentoo Dev via bugzilla." +# echo "Log file: $LOG" +# echo +# exit 1 +#fi +# +#env-update +# +#echo "Restoring world file..." +#mv /var/cache/edb/world.update_system_backup /var/cache/edb/world + +REBUILD_LIST=` + echo $LDD_LIST | sed 's:\([^ ]\+\):\\>\\=\1:g' | xargs emerge -np $(cat /var/cache/edb/world) | + grep ebuild | sed 's:.*\] \([^ ]\+\) .*:\1:'` + +if echo $REBUILD_LIST | egrep -q "no.*ebuilds to satisfy"; then + echo "Packages are installed that no longer exist in Gentoo." + echo "Determine what you need to do to fix this and try again." + echo "The package may have been moved to a different category." + echo + echo "Easiest course of action: unmerge these by explicit versions" + echo "and re-emerge them if they still exist." + echo 'emerge -C \=package-version' + echo "Notice: $REBUILD_LIST" + exit 1 +fi + +if echo $REBUILD_LIST | grep -q "have been masked"; then + echo "Masked packages are installed and need to be rebuilt..." + echo "Either unmask them, or emerge -C them all." + echo + echo "Easiest course of action: check your ACCEPT_KEYWORDS in make.conf" + echo 'emerge -C \=package-version' + echo "Notice: $REBUILD_LIST" + exit 1 +fi + +#Join the perl module list and the binary list, sorting out dups +FULL_LIST=`echo ${REBUILD_LIST} ${MODULE_LIST} | sort -u` + +echo -e "Complete rebuild list:\n$FULL_LIST" +echo -e "Complete rebuild list:\n$FULL_LIST" >> $LOG + + +CLEAN_FAILED="" +MERGE_FAILED="" +MERGE_DONE="" + +for PACKAGE in $FULL_LIST; +do + env-update + echo "Rebuilding: $PACKAGE" + echo "Rebuilding: $PACKAGE" >> $LOG + if ! emerge --oneshot "=$PACKAGE"; then + echo "emerge $PACKAGE FAILED while in rebuild." + echo "emerge $PACKAGE FAILED while in rebuild." >> $LOG + MERGE_FAILED="$MERGE_FAILED \n$PACKAGE" + else + echo "Cleaning after $PACKAGE" + echo "Cleaning after $PACKAGE" >> $LOG + emerge -cp 2>&1 | tee -a $LOG + if ! emerge -c; then + echo "FAILED cleaning after $PACKAGE while in rebuild" + echo "FAILED cleaning after $PACKAGE while in rebuild" >> $LOG + CLEAN_FAILED="$CLEAN_FAILED \n$PACKAGE" + else + echo "Done with $PACKAGE" + echo "Done with $PACKAGE" >> $LOG + MERGE_DONE="$MERGE_DONE \n$PACKAGE" + fi + fi +done + +# One last pass of the modules - this is to catch those modules that dep'd a binary from above + +for MODULE in $MODULE_LIST; + do + env-update + echo "Rebuilding: $MODULE" + echo "Rebuilding: $MODULE" >> $LOG + if ! emerge --oneshot "=$MODULE"; then + echo "emerge $MODULE FAILED while in final rebuild." + echo "emerge $MODULE FAILED while in final rebuild." >> $LOG + + else + echo "Done with $MODULE" + echo "Done with $MODULE" >> $LOG + + + fi + done + + + + +echo +echo "Ok... We're done (really)..." +echo -e "The following packages merged successfully:$MERGE_DONE" +echo -e "The following packages merged successfully:$MERGE_DONE" >> $LOG +echo "-------------------------------------------" +echo + +if [ ! -z "$MERGE_FAILED" ]; then + echo -e "Merging failed on the following packages: $MERGE_FAILED" + echo -e "Merging failed on the following packages: $MERGE_FAILED" >> $LOG + echo "-----------------------------------------" +else + echo "All packages merged successfully." + echo "All packages merged successfully." >> $LOG +fi + +if [ ! -z "$CLEAN_FAILED" ]; then + echo -e "Weird: the following packages failed to clean:$CLEAN_FAILED" + echo -e "Weird: the following packages failed to clean:$CLEAN_FAILED" >> $LOG + echo "----------------------------------------------------------" +else + echo "All packages cleaned successfully." + echo "All packages cleaned successfully." >> $LOG +fi + +if [ -z "$MERGE_FAILED" ] && [ -z "$CLEAN_FAILED" ]; then + echo -e "\n\nEverything Completed Successfully." + echo -e "Have a nice day and thank you for flying with Gentoo." + echo -e "\n\nEverything Completed Successfully." >> $LOG + echo -e "Have a nice day and thank you for flying with Gentoo. :)" >> $LOG +else + echo -e "\n\nThere were some issues... Check the log for details. :(" + echo "Some or all of the failed packages may have been cause by a" + echo "dependancy failing earlier. Don't assume EVERYTHING is broken." + echo "Start with the first one to fail." + echo "Log is: $LOG" +fi + diff --git a/dev-lang/perl/files/perl-5.8.0-RC2-special-h2ph-not-failing-on-machine_ansi_header.patch b/dev-lang/perl/files/perl-5.8.0-RC2-special-h2ph-not-failing-on-machine_ansi_header.patch new file mode 100644 index 000000000000..c7f0d7246f03 --- /dev/null +++ b/dev-lang/perl/files/perl-5.8.0-RC2-special-h2ph-not-failing-on-machine_ansi_header.patch @@ -0,0 +1,11 @@ +--- perl-5.8.0-RC2/utils/h2ph_patched.pix 2002-06-24 12:52:31.000000000 +0200 ++++ perl-5.8.0-RC2/utils/h2ph_patched 2002-06-24 12:54:32.000000000 +0200 +@@ -39,6 +39,8 @@ + my ($t, $tab, %curargs, $new, $eval_index, $dir, $name, $args, $outfile); + my ($incl, $next); + while (defined (my $file = next_file())) { ++ next if $file eq 'machine/ansi.h'; ++ + if (-l $file and -d $file) { + link_if_possible($file) if ($opt_l); + next; diff --git a/dev-lang/perl/files/perl-5.8.0-perldoc-emptydirs.patch b/dev-lang/perl/files/perl-5.8.0-perldoc-emptydirs.patch new file mode 100644 index 000000000000..93d8e00ca5b0 --- /dev/null +++ b/dev-lang/perl/files/perl-5.8.0-perldoc-emptydirs.patch @@ -0,0 +1,10 @@ +--- utils/perldoc.PL.orig 2003-02-28 15:57:31.000000000 -0800 ++++ utils/perldoc.PL 2003-02-28 15:57:58.000000000 -0800 +@@ -340,6 +340,7 @@ + $global_target = (splitdir $s)[-1]; # XXX: why not use File::Basename? + for ($i=0; $i<@dirs; $i++) { + $dir = $dirs[$i]; ++ next unless -d $dir; + ($dir = VMS::Filespec::unixpath($dir)) =~ s!/\z!! if $Is_VMS; + if ( (! $opt_m && ( $ret = check_file $dir,"$s.pod")) + or ( $ret = check_file $dir,"$s.pm") diff --git a/dev-lang/perl/files/perl-5.8.0-prelink-lpthread.patch b/dev-lang/perl/files/perl-5.8.0-prelink-lpthread.patch new file mode 100644 index 000000000000..d38497e0aebe --- /dev/null +++ b/dev-lang/perl/files/perl-5.8.0-prelink-lpthread.patch @@ -0,0 +1,11 @@ +--- hints/linux.sh.orig 2003-02-14 18:11:50.000000000 -0800 ++++ hints/linux.sh 2003-02-14 18:12:01.000000000 -0800 +@@ -43,7 +43,7 @@ + # 'kaffe' has a /usr/lib/libnet.so which is not at all relevent for perl. + set `echo X "$libswanted "| sed -e 's/ bsd / /' -e 's/ net / /'` + shift +-libswanted="$*" ++libswanted="pthread $*" + + # If you have glibc, then report the version for ./myconfig bug reporting. + # (Configure doesn't need to know the specific version since it just uses diff --git a/dev-lang/perl/files/perl-5.8.0-sockatmark-should-__THROW.patch b/dev-lang/perl/files/perl-5.8.0-sockatmark-should-__THROW.patch new file mode 100644 index 000000000000..c3ca0484ace2 --- /dev/null +++ b/dev-lang/perl/files/perl-5.8.0-sockatmark-should-__THROW.patch @@ -0,0 +1,12 @@ +--- perl-5.8.0/perl.h.orig 2002-12-28 13:23:06.000000000 +0200 ++++ perl-5.8.0/perl.h 2002-12-28 13:23:47.000000000 +0200 +@@ -717,7 +717,7 @@ + /* sockatmark() is so new (2001) that many places might have it hidden + * behind some -D_BLAH_BLAH_SOURCE guard. */ + #if defined(HAS_SOCKATMARK) && !defined(HAS_SOCKATMARK_PROTO) +-int sockatmark(int); ++int sockatmark(int) __THROW; + #endif + + #ifdef SETERRNO + diff --git a/dev-lang/perl/files/stat.t b/dev-lang/perl/files/stat.t new file mode 100644 index 000000000000..e2ef3289218e --- /dev/null +++ b/dev-lang/perl/files/stat.t @@ -0,0 +1,289 @@ +#!./perl + +# $RCSfile: stat.t,v $$Revision: 1.1 $$Date: 2003/03/11 21:11:45 $ + +BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; +} + +use Config; + +print "1..58\n"; + +$Is_MSWin32 = $^O eq 'MSWin32'; +$Is_Dos = $^O eq 'dos'; +$Is_Dosish = $Is_Dos || $^O eq 'os2' || $Is_MSWin32; +$Is_Cygwin = $^O eq 'cygwin'; +chop($cwd = ($Is_MSWin32 ? `cd` : `pwd`)); + +$DEV = `ls -l /dev` unless $Is_Dosish or $Is_Cygwin; + +unlink "Op.stat.tmp"; +if (open(FOO, ">Op.stat.tmp")) { + # hack to make Apollo update link count: + $junk = `ls Op.stat.tmp` unless ($Is_MSWin32 || $Is_Dos); + + ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime, + $blksize,$blocks) = stat(FOO); + if ($nlink == 1) { + print "ok 1\n"; + } + else { + print "# res=$res, nlink=$nlink.\nnot ok 1\n"; + } + if ($Is_MSWin32 or $Is_Cygwin or $Is_Dos || ($mtime && $mtime == $ctime)) { + print "ok 2\n"; + } + else { + print "# |$mtime| vs |$ctime|\nnot ok 2\n"; + } + + my $funky_FAT_timestamps = $Is_Cygwin; + + sleep 3 if $funky_FAT_timestamps; + + print FOO "Now is the time for all good men to come to.\n"; + close(FOO); + + sleep 2 unless $funky_FAT_timestamps; + +} else { + print "# open failed: $!\nnot ok 1\nnot ok 2\n"; +} + +if ($Is_Dosish) { unlink "Op.stat.tmp2"} +else { + `rm -f Op.stat.tmp2;ln Op.stat.tmp Op.stat.tmp2; chmod 644 Op.stat.tmp`; +} + +($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime, + $blksize,$blocks) = stat('Op.stat.tmp'); + +if ($Is_Dosish || $Config{dont_use_nlink}) + {print "ok 3 # skipped: no link count\n";} +elsif ($nlink == 2) + {print "ok 3\n";} +else {print "# \$nlink is |$nlink|\nnot ok 3\n";} + +if ( $Is_Dosish + # Solaris tmpfs bug + || ($cwd =~ m#^/tmp# and $mtime && $mtime==$ctime && $^O eq 'solaris') + || $cwd =~ m#/afs/# + || $^O eq 'amigaos') { + print "ok 4 # skipped: different semantic of mtime/ctime\n"; +} +elsif ( ($mtime && $mtime != $ctime) ) { + print "ok 4\n"; +} +else { + print "not ok 4\n"; + print "#4 If test op/stat.t fails test 4, check if you are on a tmpfs\n"; + print "#4 of some sort. Building in /tmp sometimes has this problem.\n"; + print "#4 Also building on the ClearCase VOBS filesystem may cause this failure.\n"; +} +print "#4 :$mtime: should != :$ctime:\n"; + +unlink "Op.stat.tmp" or print "# unlink failed: $!\n"; +if ($Is_MSWin32) { open F, '>Op.stat.tmp' and close F } +else { `touch Op.stat.tmp` } + +if (-z 'Op.stat.tmp') {print "ok 5\n";} else {print "not ok 5\n";} +if (! -s 'Op.stat.tmp') {print "ok 6\n";} else {print "not ok 6\n";} + +$Is_MSWin32 ? `cmd /c echo hi > Op.stat.tmp` : `echo hi >Op.stat.tmp`; +if (! -z 'Op.stat.tmp') {print "ok 7\n";} else {print "not ok 7\n";} +if (-s 'Op.stat.tmp') {print "ok 8\n";} else {print "not ok 8\n";} + +unlink 'Op.stat.tmp' or print "# unlink failed: $!\n"; +$olduid = $>; # can't test -r if uid == 0 +$Is_MSWin32 ? `cmd /c echo hi > Op.stat.tmp` : `echo hi >Op.stat.tmp`; +chmod 0,'Op.stat.tmp'; +eval '$> = 1;'; # so switch uid (may not be implemented) +if (!$> || $Is_Dos || ! -r 'Op.stat.tmp') {print "ok 9\n";} else {print "not ok 9\n";} +if (!$> || ! -w 'Op.stat.tmp') {print "ok 10\n";} else {print "not ok 10\n";} +eval '$> = $olduid;'; # switch uid back (may not be implemented) +print "# olduid=$olduid, newuid=$>\n" unless ($> == $olduid); + +if (! -x 'Op.stat.tmp') {print "ok 11\n";} +else {print "not ok 11\n";} + +foreach ((12,13,14,15,16,17)) { + print "ok $_\n"; #deleted tests +} + +# in ms windows, Op.stat.tmp inherits owner uid from directory +# not sure about os/2, but chown is harmless anyway +eval { chown $>,'Op.stat.tmp'; 1 } or print "# $@" ; +chmod 0700,'Op.stat.tmp'; +if (-r 'Op.stat.tmp') {print "ok 18\n";} else {print "not ok 18\n";} +if (-w 'Op.stat.tmp') {print "ok 19\n";} else {print "not ok 19\n";} +if ($Is_Dosish) {print "ok 20 # skipped: -x by extension\n";} +elsif (-x 'Op.stat.tmp') {print "ok 20\n";} +else {print "not ok 20\n";} + +if (-f 'Op.stat.tmp') {print "ok 21\n";} else {print "not ok 21\n";} +if (! -d 'Op.stat.tmp') {print "ok 22\n";} else {print "not ok 22\n";} + +if (-d '.') {print "ok 23\n";} else {print "not ok 23\n";} +if (! -f '.') {print "ok 24\n";} else {print "not ok 24\n";} + +if (!$Is_Dosish and `ls -l perl` =~ /^l.*->/) { + if (-l 'perl') {print "ok 25\n";} else {print "not ok 25\n";} +} +else { + print "ok 25\n"; +} + +if (-o 'Op.stat.tmp') {print "ok 26\n";} else {print "not ok 26\n";} + +if (-e 'Op.stat.tmp') {print "ok 27\n";} else {print "not ok 27\n";} +unlink 'Op.stat.tmp2'; +if (! -e 'Op.stat.tmp2') {print "ok 28\n";} else {print "not ok 28\n";} + +if ($Is_MSWin32 || $Is_Dos) + {print "ok 29\n";} +elsif ($DEV !~ /\nc.* (\S+)\n/) + {print "ok 29\n";} +elsif (-c "/dev/$1") + {print "ok 29\n";} +else + {print "not ok 29\n";} +if (! -c '.') {print "ok 30\n";} else {print "not ok 30\n";} + +if ($Is_MSWin32 || $Is_Dos) + {print "ok 31\n";} +elsif ($DEV !~ /\ns.* (\S+)\n/) + {print "ok 31\n";} +elsif (-S "/dev/$1") + {print "ok 31\n";} +else + {print "not ok 31\n";} +if (! -S '.') {print "ok 32\n";} else {print "not ok 32\n";} + +if ($Is_MSWin32 || $Is_Dos) + {print "ok 33\n";} +elsif ($DEV !~ /\nb.* (\S+)\n/) + {print "ok 33\n";} +elsif (-b "/dev/$1") + {print "ok 33\n";} +else + {print "not ok 33\n";} +if (! -b '.') {print "ok 34\n";} else {print "not ok 34\n";} + +if ($^O eq 'mpeix' or $^O eq 'amigaos' or $Is_Dosish or $Is_Cygwin) { + print "ok 35 # skipped: no -u\n"; goto tty_test; +} + +$cnt = $uid = 0; + +die "Can't run op/stat.t test 35 without pwd working" unless $cwd; +my @bin = grep {-d} ($^O eq 'machten' ? + qw(/usr/bin /bin) : + qw(/sbin /usr/sbin /bin /usr/bin)); +unless (@bin) { print ("not ok 35\n"), goto tty_test; } +for my $bin (@bin) { + opendir BIN, $bin or die "Can't opendir $bin: $!"; + while (defined($_ = readdir BIN)) { + $_ = "$bin/$_"; + $cnt++; + $uid++ if -u; + last if $uid && $uid < $cnt; + } +} +closedir BIN; + +# I suppose this is going to fail somewhere... +if ($uid > 0 && $uid < $cnt) + {print "ok 35\n";} +elsif ($uid == 0) + {print ("not ok 35\n"), goto tty_test; } +else + {print "not ok 35 \n# ($uid $cnt)\n";} + +tty_test: + +# To assist in automated testing when a controlling terminal (/dev/tty) +# may not be available (at, cron rsh etc), the PERL_SKIP_TTY_TEST env var +# can be set to skip the tests that need a tty. +unless($ENV{PERL_SKIP_TTY_TEST}) { + if ($Is_MSWin32) { + print "ok 36\n"; + print "ok 37\n"; + } + else { + my $TTY = "/dev/tty"; + + $TTY = "/dev/ttyp0" if $^O eq 'rhapsody'; + + if (defined $TTY) { + unless (open(TTY, $TTY)) { + print STDERR "Can't open $TTY--run t/TEST outside of make.\n"; + } + if (-t TTY) {print "ok 36\n";} else {print "not ok 36\n";} + if (-c TTY) {print "ok 37\n";} else {print "not ok 37\n";} + close(TTY); + } else { # if some platform completely undefines $TTY + print "ok 36 # skipped\n"; + print "ok 37 # skipped\n"; + } + } + if (! -t TTY) {print "ok 38\n";} else {print "not ok 38\n";} + if (-t) {print "ok 39\n";} else {print "not ok 39\n";} +} +else { + print "ok 36\n"; + print "ok 37\n"; + print "ok 38\n"; + print "ok 39\n"; +} +open(null,"/dev/null"); +if (! -t null || -e '/xenix' || $^O eq 'machten' || $Is_MSWin32) + {print "ok 40\n";} else {print "not ok 40\n";} +close(null); + +# These aren't strictly "stat" calls, but so what? + +if (-T 'op/stat.t') {print "ok 41\n";} else {print "not ok 41\n";} +if (! -B 'op/stat.t') {print "ok 42\n";} else {print "not ok 42\n";} + +if (-B './perl' || -B './perl.exe') {print "ok 43\n";} else {print "not ok 43\n";} +if (! -T './perl' && ! -T './perl.exe') {print "ok 44\n";} else {print "not ok 44\n";} + +open(FOO,'op/stat.t'); +eval { -T FOO; }; +if ($@ =~ /not implemented/) { + print "# $@"; + for (45 .. 54) { + print "ok $_\n"; + } +} +else { + if (-T FOO) {print "ok 45\n";} else {print "not ok 45\n";} + if (! -B FOO) {print "ok 46\n";} else {print "not ok 46\n";} + $_ = <FOO>; + if (/perl/) {print "ok 47\n";} else {print "not ok 47\n";} + if (-T FOO) {print "ok 48\n";} else {print "not ok 48\n";} + if (! -B FOO) {print "ok 49\n";} else {print "not ok 49\n";} + close(FOO); + + open(FOO,'op/stat.t'); + $_ = <FOO>; + if (/perl/) {print "ok 50\n";} else {print "not ok 50\n";} + if (-T FOO) {print "ok 51\n";} else {print "not ok 51\n";} + if (! -B FOO) {print "ok 52\n";} else {print "not ok 52\n";} + seek(FOO,0,0); + if (-T FOO) {print "ok 53\n";} else {print "not ok 53\n";} + if (! -B FOO) {print "ok 54\n";} else {print "not ok 54\n";} +} +close(FOO); + +if (-T '/dev/null') {print "ok 55\n";} else {print "not ok 55\n";} +if (-B '/dev/null') {print "ok 56\n";} else {print "not ok 56\n";} + +# and now, a few parsing tests: +$_ = 'Op.stat.tmp'; +if (-f) {print "ok 57\n";} else {print "not ok 57\n";} +if (-f()) {print "ok 58\n";} else {print "not ok 58\n";} + +unlink 'Op.stat.tmp' or print "# unlink failed: $!\n"; |