Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove File::Glob::glob() in perl-5.30 #16721

Closed
p5pRT opened this issue Oct 13, 2018 · 9 comments
Closed

Remove File::Glob::glob() in perl-5.30 #16721

p5pRT opened this issue Oct 13, 2018 · 9 comments
Milestone

Comments

@p5pRT
Copy link

p5pRT commented Oct 13, 2018

Migrated from rt.perl.org#133586 (status was 'resolved')

Searchable as RT133586$

@p5pRT
Copy link
Author

p5pRT commented Oct 13, 2018

From @jkeenan

pod/perldeprecate.pod contains this section on File​::Glob​::glob()​:

#####
"File​::Glob​::glob()" will disappear

"File​::Glob" has a function called "glob", which just calls
"bsd_glob". However, its prototype is different from the
prototype of "CORE​::glob", and hence, "File​::Glob​::glob"
should not be used.

"File​::Glob​::glob()" was deprecated in Perl 5.8. A
deprecation message was issued from Perl 5.26 onwards, and
the function will disappear in Perl 5.30.

Code using "File​::Glob​::glob()" should call
"File​::Glob​::bsd_glob()" instead.
#####

This deprecation has not yet been promoted into a fatalization.

#####
$ ./bin/perl -Ilib -V | ack 'Commit id|Compiled at'
  Commit id​: 8fc0553
  Compiled at Oct 13 2018 10​:02​:56
$ ./bin/perl -MFile​::Glob -e 'File​::Glob​::glob();'
File​::Glob​::glob() will disappear in perl 5.30. Use
File​::Glob​::bsd_glob() instead. at -e line 1.
Usage​: File​::Glob​::bsd_glob(pattern_sv, ...) at -e line 1.
#####

Implement the fatalization. Adapt tests and documentation accordingly.

@p5pRT
Copy link
Author

p5pRT commented Oct 13, 2018

From @jkeenan

Summary of my perl5 (revision 5 version 29 subversion 4) configuration​:
  Commit id​: 8fc0553
  Platform​:
  osname=linux
  osvers=4.15.0-36-generic
  archname=x86_64-linux
  uname='linux zareason 4.15.0-36-generic #39-ubuntu smp mon sep 24 16​:19​:09 utc 2018 x86_64 x86_64 x86_64 gnulinux '
  config_args='-des -Dusedevel -Uversiononly -Dprefix=/home/jkeenan/testing/blead -Dman1dir=none -Dman3dir=none'
  hint=recommended
  useposix=true
  d_sigaction=define
  useithreads=undef
  usemultiplicity=undef
  use64bitint=define
  use64bitall=define
  uselongdouble=undef
  usemymalloc=n
  default_inc_excludes_dot=define
  bincompat5005=undef
  Compiler​:
  cc='cc'
  ccflags ='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
  optimize='-O2'
  cppflags='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
  ccversion=''
  gccversion='7.3.0'
  gccosandvers=''
  intsize=4
  longsize=8
  ptrsize=8
  doublesize=8
  byteorder=12345678
  doublekind=3
  d_longlong=define
  longlongsize=8
  d_longdbl=define
  longdblsize=16
  longdblkind=3
  ivtype='long'
  ivsize=8
  nvtype='double'
  nvsize=8
  Off_t='off_t'
  lseeksize=8
  alignbytes=8
  prototype=define
  Linker and Libraries​:
  ld='cc'
  ldflags =' -fstack-protector-strong -L/usr/local/lib'
  libpth=/usr/local/lib /usr/lib/gcc/x86_64-linux-gnu/7/include-fixed /usr/include/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib /lib64 /usr/lib64
  libs=-lpthread -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc
  perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
  libc=libc-2.27.so
  so=so
  useshrplib=false
  libperl=libperl.a
  gnulibc_version='2.27'
  Dynamic Linking​:
  dlsrc=dl_dlopen.xs
  dlext=so
  d_dlsymun=undef
  ccdlflags='-Wl,-E'
  cccdlflags='-fPIC'
  lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector-strong'

Characteristics of this binary (from libperl)​:
  Compile-time options​:
  HAS_TIMES
  PERLIO_LAYERS
  PERL_COPY_ON_WRITE
  PERL_DONT_CREATE_GVSV
  PERL_MALLOC_WRAP
  PERL_OP_PARENT
  PERL_PRESERVE_IVUV
  PERL_USE_DEVEL
  USE_64_BIT_ALL
  USE_64_BIT_INT
  USE_LARGE_FILES
  USE_LOCALE
  USE_LOCALE_COLLATE
  USE_LOCALE_CTYPE
  USE_LOCALE_NUMERIC
  USE_LOCALE_TIME
  USE_PERLIO
  USE_PERL_ATOF
  Built under linux
  Compiled at Oct 13 2018 10​:02​:56
  %ENV​:
  PERL2DIR="/home/jkeenan/gitwork/perl2"
  PERLBREW_HOME="/home/jkeenan/.perlbrew"
  PERLBREW_MANPATH="/home/jkeenan/perl5/perlbrew/perls/perl-5.28.0/man"
  PERLBREW_PATH="/home/jkeenan/perl5/perlbrew/bin​:/home/jkeenan/perl5/perlbrew/perls/perl-5.28.0/bin"
  PERLBREW_PERL="perl-5.28.0"
  PERLBREW_ROOT="/home/jkeenan/perl5/perlbrew"
  PERLBREW_SHELLRC_VERSION="0.84"
  PERLBREW_VERSION="0.84"
  PERL_WORKDIR="/home/jkeenan/gitwork/perl"
  @​INC​:
  lib
  /home/jkeenan/testing/blead/lib/perl5/site_perl/5.29.4/x86_64-linux
  /home/jkeenan/testing/blead/lib/perl5/site_perl/5.29.4
  /home/jkeenan/testing/blead/lib/perl5/5.29.4/x86_64-linux
  /home/jkeenan/testing/blead/lib/perl5/5.29.4

@p5pRT
Copy link
Author

p5pRT commented Oct 13, 2018

From @jkeenan

On Sat, 13 Oct 2018 14​:09​:08 GMT, jkeenan@​pobox.com wrote​:

pod/perldeprecate.pod contains this section on File​::Glob​::glob()​:

#####
"File​::Glob​::glob()" will disappear

"File​::Glob" has a function called "glob", which just calls
"bsd_glob". However, its prototype is different from the
prototype of "CORE​::glob", and hence, "File​::Glob​::glob"
should not be used.

"File​::Glob​::glob()" was deprecated in Perl 5.8. A
deprecation message was issued from Perl 5.26 onwards, and
the function will disappear in Perl 5.30.

Code using "File​::Glob​::glob()" should call
"File​::Glob​::bsd_glob()" instead.
#####

This deprecation has not yet been promoted into a fatalization.

#####
$ ./bin/perl -Ilib -V | ack 'Commit id|Compiled at'
Commit id​: 8fc0553
Compiled at Oct 13 2018 10​:02​:56
$ ./bin/perl -MFile​::Glob -e 'File​::Glob​::glob();'
File​::Glob​::glob() will disappear in perl 5.30. Use
File​::Glob​::bsd_glob() instead. at -e line 1.
Usage​: File​::Glob​::bsd_glob(pattern_sv, ...) at -e line 1.
#####

Implement the fatalization. Adapt tests and documentation accordingly.

Please review the implementation in this branch​:

smoke-me/jkeenan/133586-file-glob-glob

Or in the patch attached.

It would be good to get this reviewed and merged to blead in time for the monthly development release scheduled for next Saturday, Oct 20.

Thank you very much.
--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

p5pRT commented Oct 13, 2018

From @jkeenan

113586-0001-Remove-File-Glob-glob-in-perl-5.30.patch
From b2a70ee1c150f5347eaa39d7243e77e7cff726ed Mon Sep 17 00:00:00 2001
From: James E Keenan <jkeenan@cpan.org>
Date: Sat, 13 Oct 2018 15:48:39 -0400
Subject: [PATCH] Remove File::Glob::glob() in perl-5.30

For: RT # 133586
---
 ext/File-Glob/Glob.pm   | 20 ++++++--------------
 ext/File-Glob/t/basic.t | 15 +++++++++------
 2 files changed, 15 insertions(+), 20 deletions(-)

diff --git a/ext/File-Glob/Glob.pm b/ext/File-Glob/Glob.pm
index 07df4941a1..368a755f50 100644
--- a/ext/File-Glob/Glob.pm
+++ b/ext/File-Glob/Glob.pm
@@ -13,7 +13,7 @@ require XSLoader;
 %EXPORT_TAGS = (
     'glob' => [ qw(
         GLOB_ABEND
-	GLOB_ALPHASORT
+        GLOB_ALPHASORT
         GLOB_ALTDIRFUNC
         GLOB_BRACE
         GLOB_CSH
@@ -29,15 +29,13 @@ require XSLoader;
         GLOB_QUOTE
         GLOB_TILDE
         bsd_glob
-        glob
     ) ],
 );
 $EXPORT_TAGS{bsd_glob} = [@{$EXPORT_TAGS{glob}}];
-pop @{$EXPORT_TAGS{bsd_glob}}; # no "glob"
 
 @EXPORT_OK   = (@{$EXPORT_TAGS{'glob'}}, 'csh_glob');
 
-$VERSION = '1.31';
+$VERSION = '1.32';
 
 sub import {
     require Exporter;
@@ -72,17 +70,11 @@ if ($^O =~ /^(?:MSWin32|VMS|os2|dos|riscos)$/) {
     $DEFAULT_FLAGS |= GLOB_NOCASE();
 }
 
-# File::Glob::glob() is deprecated because its prototype is different from
-# CORE::glob() (use bsd_glob() instead)
+# File::Glob::glob() removed in perl-5.30 because its prototype is different
+# from CORE::glob() (use bsd_glob() instead)
 sub glob {
-    use 5.024;
-    use warnings ();
-    warnings::warnif (deprecated =>
-         "File::Glob::glob() will disappear in perl 5.30. " .
-         "Use File::Glob::bsd_glob() instead.") unless state $warned ++;
-
-    splice @_, 1; # no flags
-    goto &bsd_glob;
+    die "File::Glob::glob() was removed in perl 5.30. " .
+         "Use File::Glob::bsd_glob() instead. $!";
 }
 
 1;
diff --git a/ext/File-Glob/t/basic.t b/ext/File-Glob/t/basic.t
index f0363cdcdb..6ac911c6d5 100644
--- a/ext/File-Glob/t/basic.t
+++ b/ext/File-Glob/t/basic.t
@@ -44,17 +44,20 @@ if (opendir(D, ".")) {
    @correct = grep { !/^\./ } sort readdir(D);
    closedir D;
 }
-my @a = do {no warnings 'deprecated'; File::Glob::glob("*", 0);};
-@a = sort @a;
-if (GLOB_ERROR) {
-    fail(GLOB_ERROR);
-} else {
-    is_deeply(\@a, \@correct);
+{
+    local $@;
+    my $expect =
+        qr/File::Glob::glob\(\) was removed in perl 5\.30\. Use File::Glob::bsd_glob\(\) instead/;
+    eval { File::Glob::glob("*", 0); };
+    like $@, $expect,
+        "Got expected error message for removal of File::Glob::glob()";
 }
 chdir '..' or die "chdir .. $!";
 
 # look up the user's home directory
 # should return a list with one item, and not set ERROR
+my @a;
+
 SKIP: {
     my ($name, $home);
     skip $^O, 1 if $^O eq 'MSWin32' || $^O eq 'NetWare' || $^O eq 'VMS'
-- 
2.17.1

@p5pRT
Copy link
Author

p5pRT commented Oct 13, 2018

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Oct 17, 2018

From @jkeenan

Following review by Tony Cook, merged to blead in commit df8b709.
--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

p5pRT commented Oct 17, 2018

@jkeenan - Status changed from 'open' to 'pending release'

@p5pRT
Copy link
Author

p5pRT commented May 22, 2019

From @khwilliamson

Thank you for filing this report. You have helped make Perl better.

With the release today of Perl 5.30.0, this and 160 other issues have been
resolved.

Perl 5.30.0 may be downloaded via​:
https://metacpan.org/release/XSAWYERX/perl-5.30.0

If you find that the problem persists, feel free to reopen this ticket.

@p5pRT
Copy link
Author

p5pRT commented May 22, 2019

@khwilliamson - Status changed from 'pending release' to 'resolved'

@p5pRT p5pRT closed this as completed May 22, 2019
@toddr toddr added this to the 5.30.0 milestone Oct 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants