diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2002-10-27 22:15:11 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2002-10-27 22:15:11 +0000 |
commit | 5ab2efff226cc7065f67b7ba993c1839e9868140 (patch) | |
tree | b5f71407f887b2db8bc74d4ff6939c87b7c51ceb /gnu | |
parent | 5bb34dc7b3e6b2d7a80320954226cc264e281253 (diff) |
stock perl 5.8.0 from CPAN
Diffstat (limited to 'gnu')
-rw-r--r-- | gnu/usr.bin/perl/NetWare/config.wc | 150 | ||||
-rw-r--r-- | gnu/usr.bin/perl/Porting/testall.atom | 2 | ||||
-rw-r--r-- | gnu/usr.bin/perl/Porting/thirdclean | 11 | ||||
-rw-r--r-- | gnu/usr.bin/perl/README.dgux | 4 | ||||
-rw-r--r-- | gnu/usr.bin/perl/lib/Exporter.t | 114 | ||||
-rw-r--r-- | gnu/usr.bin/perl/lib/File/Find/t/find.t | 444 | ||||
-rw-r--r-- | gnu/usr.bin/perl/lib/File/Find/t/taint.t | 117 | ||||
-rw-r--r-- | gnu/usr.bin/perl/t/lib/warnings/perly | 1 |
8 files changed, 207 insertions, 636 deletions
diff --git a/gnu/usr.bin/perl/NetWare/config.wc b/gnu/usr.bin/perl/NetWare/config.wc index 3da939a3db2..28d22903e2f 100644 --- a/gnu/usr.bin/perl/NetWare/config.wc +++ b/gnu/usr.bin/perl/NetWare/config.wc @@ -1,6 +1,7 @@ ## Configured by: ~cf_email~ ## Target system: NetWare Author='Guruprasad' +PERL_CONFIG_SH='true' Date='$Date' Header='' Id='$Id' @@ -37,7 +38,6 @@ bash='' bin='~INST_TOP~~INST_VER~\bin~INST_ARCH~' binexp='~INST_TOP~~INST_VER~\bin~INST_ARCH~' bison='' -bootstrap_charset='undef' byacc='byacc' byteorder='1234' c='' @@ -51,7 +51,7 @@ ccsymbols='' cf_by='nobody' cf_email='nobody@no.where.net' cf_time='' -charbits='8' +charsize='1' chgrp='' chmod='' chown='' @@ -89,34 +89,20 @@ d_PRIi64='undef' d_PRIo64='undef' d_PRIu64='undef' d_PRIx64='undef' -d_SCNfldbl='undef' -d__fwalk='undef' d_access='define' d_accessx='undef' -d_aintl='undef' d_alarm='undef' d_archlib='define' -d_asctime64='undef' d_asctime_r='undef' d_atolf='undef' d_atoll='undef' -d_attribute_deprecated='undef' -d_attribute_format='undef' -d_attribute_malloc='undef' -d_attribute_nonnull='undef' -d_attribute_noreturn='undef' -d_attribute_pure='undef' -d_attribute_unused='undef' -d_attribute_warn_unused_result='undef' +d_attribut='undef' d_bcmp='undef' d_bcopy='undef' d_bsd='define' d_bsdgetpgrp='undef' d_bsdsetpgrp='undef' -d_builtin_choose_expr='undef' -d_builtin_expect='undef' d_bzero='undef' -d_c99_variadic_macros='undef' d_casti32='undef' d_castneg='define' d_charvspr='undef' @@ -124,25 +110,16 @@ d_chown='undef' d_chroot='undef' d_chsize='define' d_class='undef' -d_clearenv='undef' d_closedir='define' -d_cmsghdr_s='undef' d_const='define' -d_copysignl='undef' -d_cplusplus='undef' d_crypt='undef' d_crypt_r='undef' d_csh='undef' -d_ctermid='undef' d_ctermid_r='undef' -d_ctime64='undef' d_ctime_r='undef' d_cuserid='undef' d_dbl_dig='define' -d_dbminitproto='undef' -d_difftime64='undef' d_difftime='define' -d_dir_dd_fd='undef' d_dirfd='undef' d_dirnamlen='undef' d_dlerror='define' @@ -168,12 +145,10 @@ d_endservent_r='undef' d_endspent='undef' d_eofnblk='define' d_eunice='undef' -d_faststdio='undef' d_fchdir='undef' d_fchmod='undef' d_fchown='undef' d_fcntl='undef' -d_fcntl_can_lock='undef' d_fd_macros='define' d_fd_set='define' d_fds_bits='define' @@ -182,7 +157,6 @@ d_finite='undef' d_finitel='undef' d_flexfnam='define' d_flock='define' -d_flockproto='undef' d_fork='undef' d_fp_class='undef' d_fpathconf='undef' @@ -190,21 +164,14 @@ d_fpclass='undef' d_fpclassify='undef' d_fpclassl='undef' d_fpos64_t='undef' -d_frexpl='undef' d_fs_data_s='undef' d_fseeko='undef' d_fsetpos='define' d_fstatfs='undef' d_fstatvfs='undef' -d_fsync='undef' d_ftello='undef' d_ftime='define' -d_futimes='undef' -d_gdbm_ndbm_h_uses_prototypes='undef' -d_gdbmndbm_h_uses_prototypes='undef' -d_getaddrinfo='undef' d_getcwd='define' -d_getespwnam='undef' d_getfsstat='undef' d_getgrent='undef' d_getgrent_r='undef' @@ -219,12 +186,10 @@ d_gethostbyaddr_r='undef' d_gethostbyname_r='undef' d_gethostent_r='undef' d_gethostprotos='define' -d_getitimer='undef' d_getlogin='define' d_getlogin_r='undef' d_getmnt='undef' d_getmntent='undef' -d_getnameinfo='undef' d_getnbyaddr='undef' d_getnbyname='undef' d_getnent='undef' @@ -232,7 +197,6 @@ d_getnetbyaddr_r='undef' d_getnetbyname_r='undef' d_getnetent_r='undef' d_getnetprotos='define' -d_getpagsz='undef' d_getpbyname='define' d_getpbynumber='define' d_getpent='undef' @@ -245,7 +209,6 @@ d_getprotobyname_r='undef' d_getprotobynumber_r='undef' d_getprotoent_r='undef' d_getprotoprotos='define' -d_getprpwnam='undef' d_getpwent='undef' d_getpwent_r='undef' d_getpwnam_r='undef' @@ -261,25 +224,15 @@ d_getspent='undef' d_getspnam='undef' d_getspnam_r='undef' d_gettimeod='undef' -d_gmtime64='undef' d_gmtime_r='undef' d_gnulibc='undef' d_grpasswd='undef' d_hasmntopt='undef' d_htonl='define' -d_ilogbl='undef' -d_inc_version_list='undef' d_index='undef' d_inetaton='undef' -d_inetntop='undef' -d_inetpton='undef' d_int64_t='undef' -d_ip_mreq='undef' -d_ip_mreq_source='undef' -d_ipv6_mreq='undef' -d_ipv6_mreq_source='undef' d_isascii='define' -d_isblank='undef' d_isfinite='undef' d_isinf='undef' d_isnan='undef' @@ -287,11 +240,8 @@ d_isnanl='undef' d_killpg='undef' d_lchown='undef' d_ldbl_dig='define' -d_libm_lib_version='undef' d_link='define' -d_localtime64='undef' d_localtime_r='undef' -d_localtime_r_needs_tzset='undef' d_locconv='define' d_lockf='undef' d_longdbl='define' @@ -299,8 +249,6 @@ d_longlong='undef' d_lseekproto='define' d_lstat='undef' d_madvise='undef' -d_malloc_good_size='undef' -d_malloc_size='undef' d_mblen='define' d_mbstowcs='define' d_mbtowc='define' @@ -314,12 +262,8 @@ d_mkdtemp='undef' d_mkfifo='undef' d_mkstemp='undef' d_mkstemps='undef' -d_mktime64='undef' d_mktime='define' d_mmap='undef' -d_modfl='undef' -d_modfl_pow32_bug='undef' -d_modflproto='undef' d_mprotect='undef' d_msg='undef' d_msg_ctrunc='undef' @@ -329,17 +273,14 @@ d_msg_peek='undef' d_msg_proxy='undef' d_msgctl='undef' d_msgget='undef' -d_msghdr_s='undef' d_msgrcv='undef' d_msgsnd='undef' d_msync='undef' d_munmap='undef' d_mymalloc='undef' -d_ndbm_h_uses_prototypes='undef' d_nice='undef' d_nl_langinfo='undef' d_nv_preserves_uv='define' -d_nv_zero_is_allbits_zero='undef' d_off64_t='undef' d_old_pthread_create_joinable='undef' d_oldpthreads='undef' @@ -347,18 +288,12 @@ d_oldsock='undef' d_open3='undef' d_pathconf='undef' d_pause='undef' -d_perl_otherlibdirs='undef' d_phostname='undef' d_pipe='define' d_poll='undef' d_portable='define' -d_prctl='undef' -d_prctl_set_name='undef' -d_printf_format_null='undef' d_procselfexe='undef' -d_pseudofork='undef' d_pthread_atfork='undef' -d_pthread_attr_setscope='undef' d_pthread_yield='undef' d_pwage='undef' d_pwchange='undef' @@ -375,16 +310,12 @@ d_readdir64_r='undef' d_readdir='define' d_readdir_r='undef' d_readlink='undef' -d_readv='undef' -d_recvmsg='undef' d_rename='define' d_rewinddir='define' d_rmdir='define' d_safebcpy='undef' d_safemcpy='undef' d_sanemcmp='define' -d_sbrkproto='undef' -d_scalbnl='undef' d_sched_yield='undef' d_scm_rights='undef' d_seekdir='define' @@ -395,7 +326,6 @@ d_semctl_semid_ds='undef' d_semctl_semun='undef' d_semget='undef' d_semop='undef' -d_sendmsg='undef' d_setegid='undef' d_seteuid='undef' d_setgrent='undef' @@ -403,7 +333,6 @@ d_setgrent_r='undef' d_setgrps='undef' d_sethent='undef' d_sethostent_r='undef' -d_setitimer='undef' d_setlinebuf='undef' d_setlocale='define' d_setlocale_r='undef' @@ -414,7 +343,6 @@ d_setpgid='undef' d_setpgrp2='undef' d_setpgrp='undef' d_setprior='undef' -d_setproctitle='undef' d_setprotoent_r='undef' d_setpwent='undef' d_setpwent_r='undef' @@ -437,35 +365,19 @@ d_shmctl='undef' d_shmdt='undef' d_shmget='undef' d_sigaction='undef' -d_signbit='undef' -d_sigprocmask='undef' d_sigsetjmp='undef' -d_sin6_scope_id='undef' -d_sitearch='undef' -d_snprintf='undef' -d_sockaddr_in6='undef' -d_sockaddr_sa_len='undef' -d_sockatmark='undef' -d_sockatmarkproto='undef' d_socket='define' d_socklen_t='undef' d_sockpair='undef' -d_socks5_init='undef' -d_sprintf_returns_strlen='undef' d_sqrtl='undef' d_srand48_r='undef' d_srandom_r='undef' -d_sresgproto='undef' -d_sresuproto='undef' d_statblks='undef' d_statfs_f_flags='undef' d_statfs_s='undef' -d_static_inline='undef' d_statvfs='undef' d_stdio_cnt_lval='undef' d_stdio_ptr_lval='undef' -d_stdio_ptr_lval_nochange_cnt='undef' -d_stdio_ptr_lval_sets_cnt='undef' d_stdio_stream_array='undef' d_stdiobase='undef' d_stdstdio='undef' @@ -476,13 +388,10 @@ d_strerrm='strerror(e)' d_strerror='define' d_strerror_r='undef' d_strftime='define' -d_strlcat='undef' -d_strlcpy='undef' d_strtod='define' d_strtol='define' d_strtold='undef' d_strtoll='undef' -d_strtoq='undef' d_strtoul='define' d_strtoull='undef' d_strtouq='undef' @@ -490,7 +399,6 @@ d_strxfrm='define' d_suidsafe='undef' d_symlink='undef' d_syscall='undef' -d_syscallproto='undef' d_sysconf='undef' d_sysernlst='' d_syserrlst='define' @@ -500,7 +408,6 @@ d_tcsetpgrp='undef' d_telldir='define' d_telldirproto='define' d_time='define' -d_timegm='undef' d_times='undef' d_tm_tm_gmtoff='undef' d_tm_tm_zone='undef' @@ -508,15 +415,10 @@ d_tmpnam_r='undef' d_truncate='undef' d_ttyname_r='undef' d_tzname='define' -d_u32align='undef' -d_ualarm='undef' d_umask='define' d_uname='define' d_union_semun='define' d_unordered='undef' -d_unsetenv='undef' -d_usleep='undef' -d_usleepproto='undef' d_ustat='undef' d_vendorarch='undef' d_vendorbin='undef' @@ -527,19 +429,14 @@ d_voidsig='define' d_voidtty='' d_volatile='define' d_vprintf='define' -d_vsnprintf='undef' d_wait4='undef' d_waitpid='define' d_wcstombs='define' d_wctomb='define' -d_writev='undef' d_xenix='undef' date='date' db_hashtype='int' db_prefixtype='int' -db_version_major='0' -db_version_minor='0' -db_version_patch='0' def_perlroot='sys:\perl\scripts' def_temp='sys:\perl\temp' defvoidused='15' @@ -549,8 +446,7 @@ dlsrc='dl_netware.xs' doublesize='8' drand01='(rand()/(double)((unsigned)1<<RANDBITS))' drand48_r_proto='0' -dtrace='' -dynamic_ext='Socket IO Fcntl Opcode SDBM_File attributes' +dynamic_ext='Socket IO Fcntl Opcode SDBM_File attrs Thread' eagain='EAGAIN' ebcdic='undef' echo='echo' @@ -622,7 +518,6 @@ i64type='__int64' i8size='1' i8type='char' i_arpainet='define' -i_assert='define' i_bsdioctl='' i_crypt='undef' i_db='undef' @@ -635,18 +530,14 @@ i_float='define' i_fp='undef' i_fp_class='undef' i_gdbm='undef' -i_gdbm_ndbm='undef' -i_gdbmndbm='undef' i_grp='undef' i_ieeefp='undef' i_inttypes='undef' i_langinfo='undef' -i_libutil='undef' i_limits='define' i_locale='define' i_machcthr='undef' i_malloc='define' -i_mallocmalloc='undef' i_math='define' i_memory='undef' i_mntent='undef' @@ -656,7 +547,6 @@ i_neterrno='undef' i_netinettcp='undef' i_niin='define' i_poll='undef' -i_prot='undef' i_pthread='undef' i_pwd='undef' i_rpcsvcdbm='define' @@ -665,7 +555,6 @@ i_sgtty='undef' i_shadow='undef' i_socks='undef' i_stdarg='define' -i_stdbool='define' i_stddef='define' i_stdlib='define' i_string='define' @@ -682,7 +571,6 @@ i_sysmode='undef' i_sysmount='undef' i_sysndir='undef' i_sysparam='undef' -i_syspoll='undef' i_sysresrc='undef' i_syssecrt='undef' i_sysselct='undef' @@ -774,7 +662,6 @@ lpr='' ls='dir' lseeksize='4' lseektype='off_t' -mad='undef' mail='' mailx='' make='nmake' @@ -802,7 +689,6 @@ mydomain='' myhostname='' myuname='' n='-n' -need_va_copy='define' netdb_hlen_type='int' netdb_host_type='char *' netdb_name_type='char *' @@ -815,8 +701,6 @@ nroff='' nvEUformat='"E"' nvFUformat='"F"' nvGUformat='"G"' -nv_overflows_integers_at='256.0*256.0*256.0*256.0*256.0*256.0*2.0*2.0*2.0*2.0*2.0' -nv_preserves_uv_bits='32' nveformat='"e"' nvfformat='"f"' nvgformat='"g"' @@ -829,7 +713,6 @@ optimize='-O' orderlib='false' osname='NetWare' osvers='5.x' -otherlibdirs='' package='perl5' pager='more /e' passcat='' @@ -837,13 +720,13 @@ patchlevel='~PATCHLEVEL~' path_sep=';' perl5='' perl='perl' -perl_static_inline='static' perladmin='' perlpath='~INST_TOP~~INST_VER~\bin~INST_ARCH~\perl.nlm' pg='' phostname='hostname' pidtype='int' plibpth='' +pm_apiversion='5.005' pmake='' pr='' prefix='~INST_TOP~' @@ -867,10 +750,6 @@ revision='5' rm='del' rmail='' runnm='true' -sGMTIME_max='2147483647' -sGMTIME_min='0' -sLOCALTIME_max='2147483647' -sLOCALTIME_min='0' sPRIEldbl='"E"' sPRIFldbl='"F"' sPRIGldbl='"G"' @@ -883,7 +762,6 @@ sPRIi64='"li"' sPRIo64='"lo"' sPRIu64='"lu"' sPRIx64='"lx"' -sSCNfldbl='' sched_yield='' scriptdir='~INST_TOP~~INST_VER~\bin' scriptdirexp='~INST_TOP~~INST_VER~\bin' @@ -939,8 +817,6 @@ srand48_r_proto='0' srandom_r_proto='0' src='' ssizetype='int' -st_ino_sign='1' -st_ino_size='4' startperl='#!perl' startsh='#!/bin/sh' static_ext='DynaLoader' @@ -958,7 +834,6 @@ subversion='~SUBVERSION~' sysman='/usr/man/man1' tail='' tar='' -targetarch='' tbl='' tee='' test='' @@ -988,29 +863,19 @@ uquadtype='unsigned __int64' use5005threads='undef' use64bitall='undef' use64bitint='undef' -usecrosscompile='undef' -usedevel='undef' usedl='define' -usedtrace='undef' -usefaststdio='undef' useithreads='define' -usekernprocpathname='undef' uselargefiles='undef' uselongdouble='undef' -usemallocwrap='undef' usemorebits='undef' usemultiplicity='define' usemymalloc='n' usenm='false' -usensgetexecutablepath='undef' useopcode='true' useperlio='undef' useposix='true' -usereentrant='undef' -userelocatableinc='undef' usesfio='false' -useshrplib='true' -usesitecustomize='undef' +useshrplib='yes' usesocks='undef' usethreads='undef' usevendorprefix='undef' @@ -1023,7 +888,6 @@ uvsize='4' uvtype='unsigned long' uvuformat='"lu"' uvxformat='"lx"' -vaproto='undef' vendorarch='' vendorarchexp='' vendorbin='' @@ -1037,6 +901,7 @@ version='~VERSION~' vi='' voidflags='15' xlibpth='/usr/lib/386 /lib/386' +xs_apiversion='5.6.0' zcat='' zip='zip' PERL_REVISION='~PERL_REVISION~' @@ -1047,7 +912,6 @@ PERL_API_SUBVERSION='~PERL_API_SUBVERSION~' PERL_API_VERSION='~PERL_API_VERSION~' PATCHLEVEL='~PERL_VERSION~' SUBVERSION='~PERL_SUBVERSION~' -PERL_CONFIG_SH='true' base_import='' nlm_version='' mpktool='' diff --git a/gnu/usr.bin/perl/Porting/testall.atom b/gnu/usr.bin/perl/Porting/testall.atom index 8796f08f2b2..a709cfdb016 100644 --- a/gnu/usr.bin/perl/Porting/testall.atom +++ b/gnu/usr.bin/perl/Porting/testall.atom @@ -1,7 +1,7 @@ #!/bin/sh # -# testall.atom - test suite profiling on Tru 64 +# testall.atom # # This script creates all.Counts file that can be fed to prof(1) # to produce various basic block counting profiles. diff --git a/gnu/usr.bin/perl/Porting/thirdclean b/gnu/usr.bin/perl/Porting/thirdclean index 8f1d3f894bd..c45de156178 100644 --- a/gnu/usr.bin/perl/Porting/thirdclean +++ b/gnu/usr.bin/perl/Porting/thirdclean @@ -1,12 +1,3 @@ -#!./perl - -# DAPM: this description is from the original commit message: -# this appears to be a HP leak detection thing: -# -# Add a script for cleaning out the "known noise" -# from Third Degree reports: either noise caused -# by libc itself, or Perl_yyparse leaks. - local $/; $_ = <ARGV>; @@ -37,7 +28,7 @@ $leak[ 0] =~ s/.* were found:\n\n//m; # Snip off totals. # actual length. @accv = grep { ! /-- rih --.+(?:memmove|strcpy).+moreswitches/s } @accv; @accv = grep { ! /-- (?:rih|rus) --.+strcpy.+gv_fetchfile/s } @accv; -@accv = grep { ! /-- rih --.+strcmp.+doopen_pm/s } @accv; +@accv = grep { ! /-- rih --.+strcmp.+doopen_pmc/s } @accv; @accv = grep { ! /-- rih --.+strcmp.+gv_fetchpv/s } @accv; @accv = grep { ! /-- r[ui]h --.+strcmp.+gv_fetchmeth/s } @accv; @accv = grep { ! /-- rih --.+memmove.+my_setenv/s } @accv; diff --git a/gnu/usr.bin/perl/README.dgux b/gnu/usr.bin/perl/README.dgux index fd6eaa3baa1..accb7384a8a 100644 --- a/gnu/usr.bin/perl/README.dgux +++ b/gnu/usr.bin/perl/README.dgux @@ -79,7 +79,7 @@ After configuration is done correctly give "make" to compile. =head2 Testing Perl on DG/UX -Issuing a "make test" will run all the tests. +Issuing a "make test" will run all the tests. If the test lib/ftmp-security gives you as a result something like @@ -102,7 +102,7 @@ Run the command "make install" =head1 AUTHOR Takis Psarogiannakopoulos -University of Cambridge +Universirty of Cambridge Centre for Mathematical Sciences Department of Pure Mathematics Wilberforce road diff --git a/gnu/usr.bin/perl/lib/Exporter.t b/gnu/usr.bin/perl/lib/Exporter.t index 06c4b056529..d2a9289c61c 100644 --- a/gnu/usr.bin/perl/lib/Exporter.t +++ b/gnu/usr.bin/perl/lib/Exporter.t @@ -1,14 +1,12 @@ -#!perl -w +#!./perl BEGIN { - if( $ENV{PERL_CORE} ) { - chdir 't' if -d 't'; - @INC = '../lib'; - } + chdir 't' if -d 't'; + @INC = '../lib'; } # Can't use Test::Simple/More, they depend on Exporter. -my $test; +my $test = 1; sub ok ($;$) { my($ok, $name) = @_; @@ -23,12 +21,9 @@ sub ok ($;$) { } -BEGIN { - $test = 1; - print "1..31\n"; - require Exporter; - ok( 1, 'Exporter compiled' ); -} +print "1..24\n"; +require Exporter; +ok( 1, 'Exporter compiled' ); BEGIN { @@ -80,7 +75,7 @@ $seat = 'seat'; BEGIN {*is = \&Is}; sub Is { 'Is' }; -Exporter::export_ok_tags(); +Exporter::export_ok_tags; my %tags = map { $_ => 1 } map { @$_ } values %EXPORT_TAGS; my %exportok = map { $_ => 1 } @EXPORT_OK; @@ -107,7 +102,7 @@ my $got = eval {&lifejacket}; # Testing->import is called. ::ok( eval "defined &is", "Import a subroutine where exporter must create the typeglob" ); -$got = eval "&is"; +my $got = eval "&is"; ::ok ( $@ eq "", 'check we can call the imported autoloaded subroutine') or chomp ($@), print STDERR "# \$\@ is $@\n"; ::ok ( $got eq 'Is', 'and that it gave the correct result') @@ -119,21 +114,17 @@ package Bar; my @imports = qw($seatbelt &Above stuff @wailing %left); Testing->import(@imports); -::ok( (! grep { my ($s, $n) = @$_; eval "\\$s$n != \\${s}Testing::$n" } - map { /^(\W)(\w+)/ ? [$1, $2] : ['&', $_] } - @imports), - 'import by symbols' ); +::ok( (!grep { eval "!defined $_" } map({ /^\w/ ? "&$_" : $_ } @imports)), + 'import by symbols' ); package Yar; my @tags = qw(:This :tray); Testing->import(@tags); -::ok( (! grep { my ($s, $n) = @$_; eval "\\$s$n != \\${s}Testing::$n" } - map { /^(\W)(\w+)/ ? [$1, $2] : ['&', $_] } - map { @$_ } - @{$Testing::EXPORT_TAGS{@tags}}), - 'import by tags' ); +::ok( (!grep { eval "!defined $_" } map { /^\w/ ? "&$_" : $_ } + map { @$_ } @{$Testing::EXPORT_TAGS{@tags}}), + 'import by tags' ); package Arrr; @@ -145,22 +136,17 @@ Testing->import(qw(!lifejacket)); package Mars; Testing->import('/e/'); -::ok( (! grep { my ($s, $n) = @$_; eval "\\$s$n != \\${s}Testing::$n" } - map { /^(\W)(\w+)/ ? [$1, $2] : ['&', $_] } - grep { /e/ } - @Testing::EXPORT, @Testing::EXPORT_OK), - 'import by regex'); +::ok( (!grep { eval "!defined $_" } map { /^\w/ ? "&$_" : $_ } + grep { /e/ } @Testing::EXPORT, @Testing::EXPORT_OK), + 'import by regex'); package Venus; Testing->import('!/e/'); -::ok( (! grep { my ($s, $n) = @$_; eval "\\$s$n == \\${s}Testing::$n" } - map { /^(\W)(\w+)/ ? [$1, $2] : ['&', $_] } - grep { /e/ } - @Testing::EXPORT, @Testing::EXPORT_OK), - 'deny import by regex'); - +::ok( (!grep { eval "defined $_" } map { /^\w/ ? "&$_" : $_ } + grep { /e/ } @Testing::EXPORT, @Testing::EXPORT_OK), + 'deny import by regex'); ::ok( !defined &lifejacket, 'further denial' ); @@ -180,7 +166,7 @@ eval { Yet::More::Testing->require_version(10); 1 }; my $warnings; BEGIN { - local $SIG{__WARN__} = sub { $warnings = join '', @_ }; + $SIG{__WARN__} = sub { $warnings = join '', @_ }; package Testing::Unused::Vars; @ISA = qw(Exporter); @EXPORT = qw(this $TODO that); @@ -192,61 +178,3 @@ BEGIN { ::ok( !$warnings, 'Unused variables can be exported without warning' ) || print "# $warnings\n"; -package Moving::Target; -@ISA = qw(Exporter); -@EXPORT_OK = qw (foo); - -sub foo {"This is foo"}; -sub bar {"This is bar"}; - -package Moving::Target::Test; - -Moving::Target->import ('foo'); - -::ok (foo() eq "This is foo", "imported foo before EXPORT_OK changed"); - -push @Moving::Target::EXPORT_OK, 'bar'; - -Moving::Target->import ('bar'); - -::ok (bar() eq "This is bar", "imported bar after EXPORT_OK changed"); - -package The::Import; - -use Exporter 'import'; - -::ok(\&import == \&Exporter::import, "imported the import routine"); - -@EXPORT = qw( wibble ); -sub wibble {return "wobble"}; - -package Use::The::Import; - -The::Import->import; - -my $val = eval { wibble() }; -::ok($val eq "wobble", "exported importer worked"); - -# Check that Carp recognizes Exporter as internal to Perl -require Carp; -eval { Carp::croak() }; -::ok($Carp::Internal{Exporter}, "Carp recognizes Exporter"); -::ok($Carp::Internal{'Exporter::Heavy'}, "Carp recognizes Exporter::Heavy"); - -package Exporter::for::Tied::_; - -@ISA = 'Exporter'; -@EXPORT = 'foo'; - -package Tied::_; - -sub TIESCALAR{bless[]} -# no tie methods! - -{ - tie my $t, __PACKAGE__; - for($t) { # $_ is now tied - import Exporter::for::Tied::_; - } -} -::ok(1, 'import with tied $_'); diff --git a/gnu/usr.bin/perl/lib/File/Find/t/find.t b/gnu/usr.bin/perl/lib/File/Find/t/find.t index 96a10005114..c28183348f3 100644 --- a/gnu/usr.bin/perl/lib/File/Find/t/find.t +++ b/gnu/usr.bin/perl/lib/File/Find/t/find.t @@ -1,33 +1,22 @@ #!./perl -use strict; -use Cwd; + my %Expect_File = (); # what we expect for $_ my %Expect_Name = (); # what we expect for $File::Find::name/fullname my %Expect_Dir = (); # what we expect for $File::Find::dir my $symlink_exists = eval { symlink("",""); 1 }; -my ($warn_msg, @files, $file); +my $warn_msg; BEGIN { - require File::Spec; chdir 't' if -d 't'; - # May be doing dynamic loading while @INC is all relative - unshift @INC => File::Spec->rel2abs('../lib'); + unshift @INC => '../lib'; $SIG{'__WARN__'} = sub { $warn_msg = $_[0]; warn "# $_[0]"; } } -my $test_count = 98; -$test_count += 119 if $symlink_exists; -$test_count += 26 if $^O eq 'MSWin32'; -$test_count += 2 if $^O eq 'MSWin32' and $symlink_exists; - -print "1..$test_count\n"; -#if ( $symlink_exists ) { print "1..199\n"; } -#else { print "1..85\n"; } - -my $orig_dir = cwd(); +if ( $symlink_exists ) { print "1..188\n"; } +else { print "1..78\n"; } # Uncomment this to see where File::Find is chdir'ing to. Helpful for # debugging its little jaunts around the filesystem. @@ -62,32 +51,19 @@ BEGIN { cleanup(); -$::count_commonsense = 0; -find({wanted => sub { ++$::count_commonsense if $_ eq 'commonsense.t'; } }, +find({wanted => sub { print "ok 1\n" if $_ eq 'commonsense.t'; } }, File::Spec->curdir); -if ($::count_commonsense == 1) { - print "ok 1\n"; -} else { - print "not ok 1 # found $::count_commonsense files named 'commonsense.t'\n"; -} -$::count_commonsense = 0; -finddepth({wanted => sub { ++$::count_commonsense if $_ eq 'commonsense.t'; } }, +finddepth({wanted => sub { print "ok 2\n" if $_ eq 'commonsense.t'; } }, File::Spec->curdir); -if ($::count_commonsense == 1) { - print "ok 2\n"; -} else { - print "not ok 2 # found $::count_commonsense files named 'commonsense.t'\n"; -} + my $case = 2; my $FastFileTests_OK = 0; sub cleanup { - chdir($orig_dir); - my $need_updir = 0; if (-d dir_path('for_find')) { - $need_updir = 1 if chdir(dir_path('for_find')); + chdir(dir_path('for_find')); } if (-d dir_path('fa')) { unlink file_path('fa', 'fa_ord'), @@ -95,38 +71,16 @@ sub cleanup { file_path('fa', 'faa', 'faa_ord'), file_path('fa', 'fab', 'fab_ord'), file_path('fa', 'fab', 'faba', 'faba_ord'), - file_path('fa', 'fac', 'faca'), file_path('fb', 'fb_ord'), - file_path('fb', 'fba', 'fba_ord'), - file_path('fb', 'fbc', 'fbca'); + file_path('fb', 'fba', 'fba_ord'); rmdir dir_path('fa', 'faa'); rmdir dir_path('fa', 'fab', 'faba'); rmdir dir_path('fa', 'fab'); - rmdir dir_path('fa', 'fac'); rmdir dir_path('fa'); rmdir dir_path('fb', 'fba'); - rmdir dir_path('fb', 'fbc'); rmdir dir_path('fb'); } - if (-d dir_path('fc')) { - unlink ( - file_path('fc', 'fca', 'match_alpha'), - file_path('fc', 'fca', 'match_beta'), - file_path('fc', 'fcb', 'match_gamma'), - file_path('fc', 'fcb', 'delta'), - file_path('fc', 'fcc', 'match_epsilon'), - file_path('fc', 'fcc', 'match_zeta'), - file_path('fc', 'fcc', 'eta'), - ); - rmdir dir_path('fc', 'fca'); - rmdir dir_path('fc', 'fcb'); - rmdir dir_path('fc', 'fcc'); - rmdir dir_path('fc'); - } - if ($need_updir) { - my $updir = $^O eq 'VMS' ? File::Spec::VMS->updir() : File::Spec->updir; - chdir($updir); - } + chdir(File::Spec->updir); if (-d dir_path('for_find')) { rmdir dir_path('for_find') or print "# Can't rmdir for_find: $!\n"; } @@ -157,9 +111,9 @@ sub MkDir($$) { } sub wanted_File_Dir { - printf "# \$File::Find::dir => '$File::Find::dir'\t\$_ => '$_'\n"; + print "# \$File::Find::dir => '$File::Find::dir'\n"; + print "# \$_ => '$_'\n"; s#\.$## if ($^O eq 'VMS' && $_ ne '.'); - s/(.dir)?$//i if ($^O eq 'VMS' && -d _); Check( $Expect_File{$_} ); if ( $FastFileTests_OK ) { delete $Expect_File{ $_} @@ -181,8 +135,10 @@ sub wanted_Name { print "# \$File::Find::name => '$n'\n"; my $i = rindex($n,'/'); my $OK = exists($Expect_Name{$n}); - if ( $OK ) { - $OK= exists($Expect_Name{substr($n,0,$i)}) if $i >= 0; + unless ($^O eq 'MacOS') { + if ( $OK ) { + $OK= exists($Expect_Name{substr($n,0,$i)}) if $i >= 0; + } } Check($OK); delete $Expect_Name{$n}; @@ -193,8 +149,10 @@ sub wanted_File { s#\.$## if ($^O eq 'VMS' && $_ ne '.'); my $i = rindex($_,'/'); my $OK = exists($Expect_File{ $_}); - if ( $OK ) { - $OK= exists($Expect_File{ substr($_,0,$i)}) if $i >= 0; + unless ($^O eq 'MacOS') { + if ( $OK ) { + $OK= exists($Expect_File{ substr($_,0,$i)}) if $i >= 0; + } } Check($OK); delete $Expect_File{ $_}; @@ -212,7 +170,7 @@ sub my_preprocess { print "# --preprocess--\n"; print "# \$File::Find::dir => '$File::Find::dir' \n"; foreach $file (@files) { - $file =~ s/\.(dir)?$//i if $^O eq 'VMS'; + $file =~ s/\.(dir)?$// if $^O eq 'VMS'; print "# $file \n"; delete $Expect_Dir{ $File::Find::dir }->{$file}; } @@ -239,18 +197,29 @@ sub my_postprocess { # there are limitations. Don't try to create an absolute path, # because that may fail on operating systems that have the concept of # volume names (e.g. Mac OS). As a special case, you can pass it a "." -# as first argument, to create a directory path like "./fa/dir". If there's -# no second argument, this function will return "./" +# as first argument, to create a directory path like "./fa/dir" on +# operating systems other than Mac OS (actually, Mac OS will ignore +# the ".", if it's the first argument). If there's no second argument, +# this function will return the empty string on Mac OS and the string +# "./" otherwise. sub dir_path { my $first_arg = shift @_; if ($first_arg eq '.') { - return './' unless @_; - my $path = File::Spec->catdir(@_); - # add leading "./" - $path = "./$path"; - return $path; + if ($^O eq 'MacOS') { + return '' unless @_; + # ignore first argument; return a relative path + # with leading ":" and with trailing ":" + return File::Spec->catdir(@_); + } else { # other OS + return './' unless @_; + my $path = File::Spec->catdir(@_); + # add leading "./" + $path = "./$path"; + return $path; + } + } else { # $first_arg ne '.' return $first_arg unless @_; # return plain filename return File::Spec->catdir($first_arg, @_); # relative path @@ -259,9 +228,14 @@ sub dir_path { # Use topdir() to specify a directory path that you want to pass to -# find/finddepth. Historically topdir() differed on Mac OS classic. +# find/finddepth. Basically, topdir() does the same as dir_path() (see +# above), except that there's no trailing ":" on Mac OS. -*topdir = \&dir_path; +sub topdir { + my $path = dir_path(@_); + $path =~ s/:$// if ($^O eq 'MacOS'); + return $path; +} # Use file_path() to specify a file path that's expected for $_ @@ -272,18 +246,28 @@ sub dir_path { # file). It's independent from the platform it's run on, although # there are limitations. As a special case, you can pass it a "." as # first argument, to create a file path like "./fa/file" on operating -# systems. If there's no second argument, this function will return the -# string "./" +# systems other than Mac OS (actually, Mac OS will ignore the ".", if +# it's the first argument). If there's no second argument, this +# function will return the empty string on Mac OS and the string "./" +# otherwise. sub file_path { my $first_arg = shift @_; if ($first_arg eq '.') { - return './' unless @_; - my $path = File::Spec->catfile(@_); - # add leading "./" - $path = "./$path"; - return $path; + if ($^O eq 'MacOS') { + return '' unless @_; + # ignore first argument; return a relative path + # with leading ":", but without trailing ":" + return File::Spec->catfile(@_); + } else { # other OS + return './' unless @_; + my $path = File::Spec->catfile(@_); + # add leading "./" + $path = "./$path"; + return $path; + } + } else { # $first_arg ne '.' return $first_arg unless @_; # return plain filename return File::Spec->catfile($first_arg, @_); # relative path @@ -297,9 +281,15 @@ sub file_path { # case, also use this function to specify a file path that's expected # for $_. # -# Historically file_path_name differed on Mac OS classic. - -*file_path_name = \&file_path; +# Basically, file_path_name() does the same as file_path() (see +# above), except that there's always a leading ":" on Mac OS, even for +# plain file/directory names. + +sub file_path_name { + my $path = file_path(@_); + $path = ":$path" if (($^O eq 'MacOS') && ($path !~ /:/)); + return $path; +} @@ -310,7 +300,11 @@ MkDir( dir_path('fb'), 0770 ); touch( file_path('fb', 'fb_ord') ); MkDir( dir_path('fb', 'fba'), 0770 ); touch( file_path('fb', 'fba', 'fba_ord') ); -CheckDie( symlink('../fb','fa/fsl') ) if $symlink_exists; +if ($^O eq 'MacOS') { + CheckDie( symlink(':fb',':fa:fsl') ) if $symlink_exists; +} else { + CheckDie( symlink('../fb','fa/fsl') ) if $symlink_exists; +} touch( file_path('fa', 'fa_ord') ); MkDir( dir_path('fa', 'faa'), 0770 ); @@ -479,53 +473,6 @@ File::Find::find( {wanted => \&noop_wanted, Check( scalar(keys %Expect_Dir) == 0 ); -{ - print "# checking argument localization\n"; - - ### this checks the fix of perlbug [19977] ### - my @foo = qw( a b c d e f ); - my %pre = map { $_ => } @foo; - - File::Find::find( sub { } , 'fa' ) for @foo; - delete $pre{$_} for @foo; - - Check( scalar( keys %pre ) == 0 ); -} - -# see thread starting -# http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2004-02/msg00351.html -{ - print "# checking that &_ and %_ are still accessible and that\n", - "# tie magic on \$_ is not triggered\n"; - - my $true_count; - my $sub = 0; - sub _ { - ++$sub; - } - my $tie_called = 0; - - package Foo; - sub STORE { - ++$tie_called; - } - sub FETCH {return 'N'}; - sub TIESCALAR {bless []}; - package main; - - Check( scalar( keys %_ ) == 0 ); - my @foo = 'n'; - tie $foo[0], "Foo"; - - File::Find::find( sub { $true_count++; $_{$_}++; &_; } , 'fa' ) for @foo; - untie $_; - - Check( $tie_called == 0); - Check( scalar( keys %_ ) == $true_count ); - Check( $sub == $true_count ); - Check( scalar( @foo ) == 1); - Check( $foo[0] eq 'N' ); -} if ( $symlink_exists ) { print "# --- symbolic link tests --- \n"; @@ -645,7 +592,11 @@ if ( $symlink_exists ) { file_path('dangling_dir_sl') ) ); rmdir dir_path('dangling_dir'); touch(file_path('dangling_file')); - CheckDie( symlink('../dangling_file','fa/dangling_file_sl') ); + if ($^O eq 'MacOS') { + CheckDie( symlink('dangling_file', ':fa:dangling_file_sl') ); + } else { + CheckDie( symlink('../dangling_file','fa/dangling_file_sl') ); + } unlink file_path('dangling_file'); { @@ -653,7 +604,6 @@ if ( $symlink_exists ) { use warnings; %Expect_File = (File::Spec->curdir => 1, - file_path('dangling_file_sl') => 1, file_path('fa_ord') => 1, file_path('fsl') => 1, file_path('fb_ord') => 1, @@ -677,7 +627,7 @@ if ( $symlink_exists ) { topdir('dangling_dir_sl'), topdir('fa') ); Check( scalar(keys %Expect_File) == 0 ); - Check( $warn_msg =~ m|dangling_file_sl is a dangling symbolic link| ); + Check( $warn_msg =~ m|dangling_dir_sl is a dangling symbolic link| ); unlink file_path('fa', 'dangling_file_sl'), file_path('dangling_dir_sl'); @@ -685,16 +635,24 @@ if ( $symlink_exists ) { print "# check recursion\n"; - CheckDie( symlink('../faa','fa/faa/faa_sl') ); + if ($^O eq 'MacOS') { + CheckDie( symlink(':fa:faa',':fa:faa:faa_sl') ); + } else { + CheckDie( symlink('../faa','fa/faa/faa_sl') ); + } undef $@; eval {File::Find::find( {wanted => \&simple_wanted, follow => 1, no_chdir => 1}, topdir('fa') ); }; - Check( $@ =~ m|for_find[:/]fa[:/]faa[:/]faa_sl is a recursive symbolic link|i ); + Check( $@ =~ m|for_find[:/]fa[:/]faa[:/]faa_sl is a recursive symbolic link| ); unlink file_path('fa', 'faa', 'faa_sl'); print "# check follow_skip (file)\n"; - CheckDie( symlink('./fa_ord','fa/fa_ord_sl') ); # symlink to a file + if ($^O eq 'MacOS') { + CheckDie( symlink(':fa:fa_ord',':fa:fa_ord_sl') ); # symlink to a file + } else { + CheckDie( symlink('./fa_ord','fa/fa_ord_sl') ); # symlink to a file + } undef $@; eval {File::Find::finddepth( {wanted => \&simple_wanted, @@ -702,16 +660,14 @@ if ( $symlink_exists ) { follow_skip => 0, no_chdir => 1}, topdir('fa') );}; - Check( $@ =~ m|for_find[:/]fa[:/]fa_ord encountered a second time|i ); + Check( $@ =~ m|for_find[:/]fa[:/]fa_ord encountered a second time| ); # no_chdir is in effect, hence we use file_path_name to specify # the expected paths for %Expect_File %Expect_File = (file_path_name('fa') => 1, - file_path_name('fa', 'fa_ord') => 2, - # We may encounter the symlink first - file_path_name('fa', 'fa_ord_sl') => 2, + file_path_name('fa', 'fa_ord') => 1, file_path_name('fa', 'fsl') => 1, file_path_name('fa', 'fsl', 'fb_ord') => 1, file_path_name('fa', 'fsl', 'fba') => 1, @@ -735,19 +691,24 @@ if ( $symlink_exists ) { File::Find::finddepth( {wanted => \&wanted_File_Dir, follow => 1, follow_skip => 1, no_chdir => 1}, topdir('fa') ); + Check( scalar(keys %Expect_File) == 0 ); unlink file_path('fa', 'fa_ord_sl'); print "# check follow_skip (directory)\n"; - CheckDie( symlink('./faa','fa/faa_sl') ); # symlink to a directory + if ($^O eq 'MacOS') { + CheckDie( symlink(':fa:faa',':fa:faa_sl') ); # symlink to a directory + } else { + CheckDie( symlink('./faa','fa/faa_sl') ); # symlink to a directory + } undef $@; eval {File::Find::find( {wanted => \&simple_wanted, follow => 1, follow_skip => 0, no_chdir => 1}, topdir('fa') );}; - Check( $@ =~ m|for_find[:/]fa[:/]faa[:/]? encountered a second time|i ); + Check( $@ =~ m|for_find[:/]fa[:/]faa[:/]? encountered a second time| ); undef $@; @@ -756,7 +717,7 @@ if ( $symlink_exists ) { follow_skip => 1, no_chdir => 1}, topdir('fa') );}; - Check( $@ =~ m|for_find[:/]fa[:/]faa[:/]? encountered a second time|i ); + Check( $@ =~ m|for_find[:/]fa[:/]faa[:/]? encountered a second time| ); # no_chdir is in effect, hence we use file_path_name to specify # the expected paths for %Expect_File @@ -772,10 +733,7 @@ if ( $symlink_exists ) { file_path_name('fa', 'fab', 'faba') => 1, file_path_name('fa', 'fab', 'faba', 'faba_ord') => 1, file_path_name('fa', 'faa') => 1, - file_path_name('fa', 'faa', 'faa_ord') => 1, - # We may actually encounter the symlink first. - file_path_name('fa', 'faa_sl') => 1, - file_path_name('fa', 'faa_sl', 'faa_ord') => 1); + file_path_name('fa', 'faa', 'faa_ord') => 1); %Expect_Name = (); @@ -789,194 +747,8 @@ if ( $symlink_exists ) { File::Find::find( {wanted => \&wanted_File_Dir, follow => 1, follow_skip => 2, no_chdir => 1}, topdir('fa') ); - # If we encountered the symlink first, then the entries corresponding to - # the real name remain, if the real name first then the symlink - my @names = sort keys %Expect_File; - Check( @names == 1 ); - # Normalise both to the original name - s/_sl// foreach @names; - Check ($names[0] eq file_path_name('fa', 'faa', 'faa_ord')); - unlink file_path('fa', 'faa_sl'); - -} - - -# Win32 checks - [perl #41555] -if ($^O eq 'MSWin32') { - require File::Spec::Win32; - my ($volume) = File::Spec::Win32->splitpath($orig_dir, 1); - print STDERR "VOLUME = $volume\n"; - - # with chdir - %Expect_File = (File::Spec->curdir => 1, - file_path('fsl') => 1, - file_path('fa_ord') => 1, - file_path('fab') => 1, - file_path('fab_ord') => 1, - file_path('faba') => 1, - file_path('faba_ord') => 1, - file_path('faa') => 1, - file_path('faa_ord') => 1); - - delete $Expect_File{ file_path('fsl') } unless $symlink_exists; - %Expect_Name = (); - - %Expect_Dir = (dir_path('fa') => 1, - dir_path('faa') => 1, - dir_path('fab') => 1, - dir_path('faba') => 1, - dir_path('fb') => 1, - dir_path('fba') => 1); - - - - File::Find::find( {wanted => \&wanted_File_Dir}, topdir('fa')); - Check( scalar(keys %Expect_File) == 0 ); - - # no_chdir - %Expect_File = ($volume . file_path_name('fa') => 1, - $volume . file_path_name('fa', 'fsl') => 1, - $volume . file_path_name('fa', 'fa_ord') => 1, - $volume . file_path_name('fa', 'fab') => 1, - $volume . file_path_name('fa', 'fab', 'fab_ord') => 1, - $volume . file_path_name('fa', 'fab', 'faba') => 1, - $volume . file_path_name('fa', 'fab', 'faba', 'faba_ord') => 1, - $volume . file_path_name('fa', 'faa') => 1, - $volume . file_path_name('fa', 'faa', 'faa_ord') => 1); - - - delete $Expect_File{ $volume . file_path_name('fa', 'fsl') } unless $symlink_exists; - %Expect_Name = (); - - %Expect_Dir = ($volume . dir_path('fa') => 1, - $volume . dir_path('fa', 'faa') => 1, - $volume . dir_path('fa', 'fab') => 1, - $volume . dir_path('fa', 'fab', 'faba') => 1); - - File::Find::find( {wanted => \&wanted_File_Dir, no_chdir => 1}, $volume . topdir('fa')); Check( scalar(keys %Expect_File) == 0 ); -} - + unlink file_path('fa', 'faa_sl'); -if ($symlink_exists) { # Issue 68260 - print "# BUG 68260\n"; - MkDir (dir_path ('fa', 'fac'), 0770); - MkDir (dir_path ('fb', 'fbc'), 0770); - touch (file_path ('fa', 'fac', 'faca')); - CheckDie (symlink ('..////../fa/fac/faca', 'fb/fbc/fbca')); - - use warnings; - my $dangling_symlink; - local $SIG {__WARN__} = sub { - local $" = " "; - $dangling_symlink ++ if "@_" =~ /dangling symbolic link/; - }; - - File::Find::find ( - { - wanted => sub {1;}, - follow => 1, - follow_skip => 2, - dangling_symlinks => 1, - }, - File::Spec -> curdir - ); - - Check (!$dangling_symlink); -} +} -print "# RT 59750\n"; -MkDir( dir_path('fc'), 0770 ); -MkDir( dir_path('fc', 'fca'), 0770 ); -MkDir( dir_path('fc', 'fcb'), 0770 ); -MkDir( dir_path('fc', 'fcc'), 0770 ); -touch( file_path('fc', 'fca', 'match_alpha') ); -touch( file_path('fc', 'fca', 'match_beta') ); -touch( file_path('fc', 'fcb', 'match_gamma') ); -touch( file_path('fc', 'fcb', 'delta') ); -touch( file_path('fc', 'fcc', 'match_epsilon') ); -touch( file_path('fc', 'fcc', 'match_zeta') ); -touch( file_path('fc', 'fcc', 'eta') ); - -my @files_from_mixed = (); -sub wantmatch { - if ( $File::Find::name =~ m/match/ ) { - push @files_from_mixed, $_; - print "# \$_ => '$_'\n"; - } -} -find( \&wantmatch, ( - dir_path('fc', 'fca'), - dir_path('fc', 'fcb'), - dir_path('fc', 'fcc'), -) ); -Check( scalar(@files_from_mixed) == 5 ); - -@files_from_mixed = (); -find( \&wantmatch, ( - dir_path('fc', 'fca'), - dir_path('fc', 'fcb'), - file_path('fc', 'fcc', 'match_epsilon'), - file_path('fc', 'fcc', 'eta'), -) ); -Check( scalar(@files_from_mixed) == 4 ); - -if ($^O eq 'MSWin32') { - # Check F:F:f correctly handles a root directory path. - # Rather than processing the entire drive (!), simply test that the - # first file passed to the wanted routine is correct and then bail out. - $orig_dir =~ /^(\w:)/ or die "expected a drive: $orig_dir"; - my $drive = $1; - - # Determine the file in the root directory which would be - # first if processed in sorted order. Create one if necessary. - my $expected_first_file; - opendir(ROOT_DIR, "/") or die "cannot opendir /: $!\n"; - foreach my $f (sort readdir ROOT_DIR) { - if (-f "/$f") { - $expected_first_file = $f; - last; - } - } - closedir ROOT_DIR; - my $created_file; - unless (defined $expected_first_file) { - $expected_first_file = '__perl_File_Find_test.tmp'; - open(F, ">", "/$expected_first_file") && close(F) - or die "cannot create file in root directory: $!\n"; - $created_file = 1; - } - - # Run F:F:f with/without no_chdir for each possible style of root path. - # NB. If HOME were "/", then an inadvertent chdir('') would fluke the - # expected result, so ensure it is something else: - local $ENV{HOME} = $orig_dir; - foreach my $no_chdir (0, 1) { - foreach my $root_dir ("/", "\\", "$drive/", "$drive\\") { - eval { - File::Find::find({ - 'no_chdir' => $no_chdir, - 'preprocess' => sub { return sort @_ }, - 'wanted' => sub { - -f or return; # the first call is for $root_dir itself. - my $got = $File::Find::name; - my $exp = "$root_dir$expected_first_file"; - print "# no_chdir=$no_chdir $root_dir '$got'\n"; - Check($got eq $exp); - die "done"; # don't process the entire drive! - }, - }, $root_dir); - }; - # If F:F:f did not die "done" then it did not Check() either. - unless ($@ and $@ =~ /done/) { - print "# no_chdir=$no_chdir $root_dir ", - ($@ ? "error: $@" : "no files found"), "\n"; - Check(0); - } - } - } - if ($created_file) { - unlink("/$expected_first_file") - or warn "can't unlink /$expected_first_file: $!\n"; - } -} diff --git a/gnu/usr.bin/perl/lib/File/Find/t/taint.t b/gnu/usr.bin/perl/lib/File/Find/t/taint.t index 954c6780d94..91fe8ee9d86 100644 --- a/gnu/usr.bin/perl/lib/File/Find/t/taint.t +++ b/gnu/usr.bin/perl/lib/File/Find/t/taint.t @@ -1,26 +1,15 @@ #!./perl -T -use strict; -use Test::More; -BEGIN { - plan( - ${^TAINT} - ? (tests => 45) - : (skip_all => "A perl without taint support") - ); -} + my %Expect_File = (); # what we expect for $_ my %Expect_Name = (); # what we expect for $File::Find::name/fullname my %Expect_Dir = (); # what we expect for $File::Find::dir my ($cwd, $cwd_untainted); + BEGIN { - require File::Spec; chdir 't' if -d 't'; - # May be doing dynamic loading while @INC is all relative - my $lib = File::Spec->rel2abs('../lib'); - $lib = $1 if $lib =~ m/(.*)/; - unshift @INC => $lib; + unshift @INC => '../lib'; } use Config; @@ -49,15 +38,14 @@ BEGIN { $ENV{'PATH'} = join($sep,@path); } +use Test::More tests => 45; + my $symlink_exists = eval { symlink("",""); 1 }; use File::Find; use File::Spec; use Cwd; -my $orig_dir = cwd(); -( my $orig_dir_untainted ) = $orig_dir =~ m|^(.+)$|; # untaint it - cleanup(); my $found; @@ -76,10 +64,8 @@ my $case = 2; my $FastFileTests_OK = 0; sub cleanup { - chdir($orig_dir_untainted); - my $need_updir = 0; if (-d dir_path('for_find')) { - $need_updir = 1 if chdir(dir_path('for_find')); + chdir(dir_path('for_find')); } if (-d dir_path('fa')) { unlink file_path('fa', 'fa_ord'), @@ -96,10 +82,7 @@ sub cleanup { rmdir dir_path('fb', 'fba'); rmdir dir_path('fb'); } - if ($need_updir) { - my $updir = $^O eq 'VMS' ? File::Spec::VMS->updir() : File::Spec->updir; - chdir($updir); - } + chdir File::Spec->updir; if (-d dir_path('for_find')) { rmdir dir_path('for_find') or print "# Can't rmdir for_find: $!\n"; } @@ -121,7 +104,6 @@ sub wanted_File_Dir { print "# \$File::Find::dir => '$File::Find::dir'\n"; print "# \$_ => '$_'\n"; s#\.$## if ($^O eq 'VMS' && $_ ne '.'); - s/(.dir)?$//i if ($^O eq 'VMS' && -d _); ok( $Expect_File{$_}, "Expected and found $File::Find::name" ); if ( $FastFileTests_OK ) { delete $Expect_File{ $_} @@ -152,31 +134,45 @@ sub simple_wanted { # there are limitations. Don't try to create an absolute path, # because that may fail on operating systems that have the concept of # volume names (e.g. Mac OS). As a special case, you can pass it a "." -# as first argument, to create a directory path like "./fa/dir". If there's -# no second argument this function will return the string "./" +# as first argument, to create a directory path like "./fa/dir" on +# operating systems other than Mac OS (actually, Mac OS will ignore +# the ".", if it's the first argument). If there's no second argument, +# this function will return the empty string on Mac OS and the string +# "./" otherwise. sub dir_path { my $first_arg = shift @_; if ($first_arg eq '.') { - return './' unless @_; - my $path = File::Spec->catdir(@_); - # add leading "./" - $path = "./$path"; - return $path; + if ($^O eq 'MacOS') { + return '' unless @_; + # ignore first argument; return a relative path + # with leading ":" and with trailing ":" + return File::Spec->catdir(@_); + } else { # other OS + return './' unless @_; + my $path = File::Spec->catdir(@_); + # add leading "./" + $path = "./$path"; + return $path; + } + } else { # $first_arg ne '.' return $first_arg unless @_; # return plain filename - my $fname = File::Spec->catdir($first_arg, @_); # relative path - $fname = VMS::Filespec::unixpath($fname) if $^O eq 'VMS'; - return $fname; + return File::Spec->catdir($first_arg, @_); # relative path } } # Use topdir() to specify a directory path that you want to pass to -# find/finddepth. Historically topdir() differed on Mac OS classic. +# find/finddepth. Basically, topdir() does the same as dir_path() (see +# above), except that there's no trailing ":" on Mac OS. -*topdir = \&dir_path; +sub topdir { + my $path = dir_path(@_); + $path =~ s/:$// if ($^O eq 'MacOS'); + return $path; +} # Use file_path() to specify a file path that's expected for $_ @@ -186,23 +182,32 @@ sub dir_path { # form a *relative* file path (the last argument is assumed to be a # file). It's independent from the platform it's run on, although # there are limitations. As a special case, you can pass it a "." as -# first argument, to create a file path like "./fa/file". If there's no -# second argument, this function will return the string "./" otherwise. +# first argument, to create a file path like "./fa/file" on operating +# systems other than Mac OS (actually, Mac OS will ignore the ".", if +# it's the first argument). If there's no second argument, this +# function will return the empty string on Mac OS and the string "./" +# otherwise. sub file_path { my $first_arg = shift @_; if ($first_arg eq '.') { - return './' unless @_; - my $path = File::Spec->catfile(@_); - # add leading "./" - $path = "./$path"; - return $path; + if ($^O eq 'MacOS') { + return '' unless @_; + # ignore first argument; return a relative path + # with leading ":", but without trailing ":" + return File::Spec->catfile(@_); + } else { # other OS + return './' unless @_; + my $path = File::Spec->catfile(@_); + # add leading "./" + $path = "./$path"; + return $path; + } + } else { # $first_arg ne '.' return $first_arg unless @_; # return plain filename - my $fname = File::Spec->catfile($first_arg, @_); # relative path - $fname = VMS::Filespec::unixify($fname) if $^O eq 'VMS'; - return $fname; + return File::Spec->catfile($first_arg, @_); # relative path } } @@ -213,9 +218,15 @@ sub file_path { # case, also use this function to specify a file path that's expected # for $_. # -# Historically file_path_name differed on Mac OS classic. - -*file_path_name = \&file_path; +# Basically, file_path_name() does the same as file_path() (see +# above), except that there's always a leading ":" on Mac OS, even for +# plain file/directory names. + +sub file_path_name { + my $path = file_path(@_); + $path = ":$path" if (($^O eq 'MacOS') && ($path !~ /:/)); + return $path; +} MkDir( dir_path('for_find'), 0770 ); @@ -231,7 +242,11 @@ MkDir( dir_path('fb', 'fba'), 0770 ); touch( file_path('fb', 'fba', 'fba_ord') ); SKIP: { skip "Creating symlink", 1, unless $symlink_exists; - ok( symlink('../fb','fa/fsl'), 'Created symbolic link' ); +if ($^O eq 'MacOS') { + ok( symlink(':fb',':fa:fsl'), 'Created symbolic link' ); +} else { + ok( symlink('../fb','fa/fsl'), 'Created symbolic link' ); +} } touch( file_path('fa', 'fa_ord') ); diff --git a/gnu/usr.bin/perl/t/lib/warnings/perly b/gnu/usr.bin/perl/t/lib/warnings/perly index c912c0ea3c3..afc5dccc72f 100644 --- a/gnu/usr.bin/perl/t/lib/warnings/perly +++ b/gnu/usr.bin/perl/t/lib/warnings/perly @@ -8,6 +8,7 @@ sub fred {} $a = "fred" ; do $a() sub fred {} $a = "fred" ; do $a(1) + __END__ # perly.y use warnings 'deprecated' ; |