Ticket #755 (closed bug: fixed)

Opened 5 years ago

Last modified 5 years ago

'make install-dev' assumes "modern" File::Path

Reported by: doughera Owned by: jkeenan
Priority: normal Milestone:
Component: install Version: 1.2.0
Severity: medium Keywords:
Cc: mikehh, util Language:
Patch status: Platform:

Description

On an up-to-date installation of OpenSolaris/x86, the standard system perl is perl-5.8.4. At parrot r39528, running

    perl Configure.pl --prefix=/tmp/parrot
    make
    make install install-dev

runs into the following error:

perl tools/dev/install_files.pl \
    --buildprefix= \
    --prefix=/tmp/parrot \
    --exec-prefix=/tmp/parrot \
    --bindir=/tmp/parrot/bin \
    --libdir=/tmp/parrot/lib \
    --includedir=/tmp/parrot/include \
    --destdir= \
    --docdir=/tmp/parrot/share/doc \
    --versiondir=/1.2.0-devel \
    MANIFEST MANIFEST.generated
Argument "/tmp/parrot/lib/1.2.0-devel/library/YAML/Dumper" isn't numeric in mkdir at /usr/perl5/5.8.4/lib/File/Path.pm line 159.
Argument "/tmp/parrot/lib/1.2.0-devel/library/YAML/Dumper" isn't numeric in mkdir at /usr/perl5/5.8.4/lib/File/Path.pm line 159.
mkdir /tmp/parrot/lib: Permission denied at lib/Parrot/Install.pm line 179
mkdir /tmp/parrot
mkdir /tmp/parrot/lib

The immediate problem is that the installation directory /tmp/parrot has been created with bizarre permissions:

$ ls -l /tmp/parrot
d---------   2 doughera staff         69 Jun 12 15:45 parrot/

That's because lib/Parrot/Install.pm uses the 'modern' interface to File::Path, which isn't supported in perl-5.8.4.

Change History

follow-up: ↓ 3   Changed 5 years ago by jkeenan

This is a case where the version of a Perl 5 core module associated with the minimum version of Perl 5 we require for building Parrot is no longer officially supported!

According to corelist -a File::Path, Perl 5.8.4 -- which we have designated as the minimum version for building Parrot -- shipped with File::Path v1.06. But the oldest version of File::Path found on CPAN is 2.04, which was the version that shipped with Perl 5.10. The most recent version of File::Path is 2.07.

Version 2.04, which is what I have locally, supports both the 'traditional' File::Path::mkpath interface:

          mkpath(['/foo/bar/baz', 'blurfl/quux'], 1, 0711);

as well as the 'modern' interface:

           mkpath( 'foo/bar/baz', '/zug/zwang', {verbose => 1} );

The Parrot distribution contains multiple instances of each interface. On June 6, however, contributor mikehh reported that he was experiencing failures in t/tools/install_files.t and t/tools/install_dev_files.t -- failures that could be corrected if he switched from mkpath to make_path. I couldn't locate any make_path function in File::Path 2.04. mikehh said that he typically uses the most recent available versions of CPAN modules and that make_path was found in File::Path 2.07.

Investigation showed that 2.07 no longer supports the 'traditional' interface. The documentation of 'traditional' versus 'modern' found in 2.04 has been removed and, AFAICT from skimming the source code, the code for the 'traditional' interface has been removed as well. So when mikehh proposed a patch that would use make_path, I had to reject it because it's not even found in the version of File::Path shipped with Perl 5.10. I figured that it was time for lib/Parrot/Install.pm to move from the 'traditional' interface to the 'modern', and that worked for both mikehh and myself.

As per Andy's report, that doesn't work for any Perl installation that B<only> has File::Path 1.06. Now, since I subsequently switched several instances of the 'traditional' interface to the (no-longer-quite-so) 'modern' interface, if you only have 1.06 you should be getting failures in many places other than Parrot::Install (e.g., t/configure/*.t or t/steps/*.t).

So if we use the version that comes with what we have designated as the minimum version of Perl 5 needed to build Parrot, we cause breakage for people who use the latest version from CPAN. How should we proceed?

kid51

  Changed 5 years ago by doughera

I'm not sure why you say the legacy versions are unsupported. I just downloaded File::Path 2.07 from CPAN. Here's the top of the Path.pm file:

=head1 VERSION

This document describes version 2.07 of File::Path, released
2008-11-09.

=head1 SYNOPSIS

  use File::Path qw(make_path remove_tree);

  make_path('foo/bar/baz', '/zug/zwang');
  make_path('foo/bar/baz', '/zug/zwang', {
      verbose => 1,
      mode => 0711,
  });

  remove_tree('foo/bar/baz', '/zug/zwang');
  remove_tree('foo/bar/baz', '/zug/zwang', {
      verbose => 1,
      error  => \my $err_list,
  });

  # legacy (interface promoted before v2.00)
  mkpath('/foo/bar/baz');
  mkpath('/foo/bar/baz', 1, 0711);
  mkpath(['/foo/bar/baz', 'blurfl/quux'], 1, 0711);
  rmtree('foo/bar/baz', 1, 1);
  rmtree(['foo/bar/baz', 'blurfl/quux'], 1, 1);

  # legacy (interface promoted before v2.06)
  mkpath('foo/bar/baz', '/zug/zwang', { verbose => 1, mode => 0711 });
  rmtree('foo/bar/baz', '/zug/zwang', { verbose => 1, mode => 0711 });


The test suite t/Path.t also contains a number of tests that use the "legacy" interface.

in reply to: ↑ 1   Changed 5 years ago by doughera

Replying to jkeenan:

Now, since I subsequently switched several instances of the 'traditional' interface to the (no-longer-quite-so) 'modern' interface, if you only have 1.06 you should be getting failures in many places other than Parrot::Install (e.g., t/configure/*.t or t/steps/*.t).

Actually, those should work ok, though perhaps not for the reason one might initially expect. They use calls of the form mkpath($path, {mode => 0755}). The traditional interface expects the second parameter to be a boolean (specifying verbosity). It sees {mode => 0755} and evaluates it as true, prints "$path", and then creates the directory with the default permissions of 0777 as modified by the user's umask. The test suite ignores the printed message, and the test passes.

So if we use the version that comes with what we have designated as the minimum version of Perl 5 needed to build Parrot, we cause breakage for people who use the latest version from CPAN. How should we proceed?

I suspect the problem is probably the t/tools/*.t tests are mis-using the traditional interface. Enclosing the first argument in square brackets [ ] should work for all versions of File::Path.

in reply to: ↑ description   Changed 5 years ago by jkeenan

  • cc mikehh, util added

Replying to doughera:

Andy D: Util applied this patch two days ago:

r39589 | Util | 2009-06-16 10:22:35 -0400 (Tue, 16 Jun 2009) | 1 line


Index: lib/Parrot/Install.pm
===================================================================
--- lib/Parrot/Install.pm       (revision 39419)
+++ lib/Parrot/Install.pm       (working copy)
@@ -173,12 +173,16 @@
 =cut
 
 sub create_directories {
-    my($destdir, $directories) = @_;
+    my ( $destdir, $directories ) = @_;
 
-    my @dirs_created = mkpath(
-        ( grep { ! -d } map { $destdir . $_ } keys %$directories ),
-        { mode => 0777 },
-    );
+    my @dirs_to_create = grep { ! -d } map { $destdir . $_ } sort keys %{$directories};
+
+    my $print_the_dirs = 0;
+    my $mode = oct('0777');
+
+    # We must use the legacy interface to support File::Path versions before 2.01.
+    my @dirs_created = mkpath( \@dirs_to_create, $print_the_dirs, $mode );
+
     return 1;
 }

Does it resolve your immediate problem on Solaris?

mikehh: Can you install with this?

If so, then I will try to standardize throughout.

Thank you very much.
kid51

  Changed 5 years ago by doughera

Thank you. Yes, that seems to work fine. (I'd have just written $mode = 0777, but perhaps that's just me. It certainly doesn't matter.)

follow-ups: ↓ 7 ↓ 8   Changed 5 years ago by jkeenan

  • owner set to jkeenan
  • status changed from new to assigned

I will take this ticket and revert all instances of File::Path::mkpath() to the oldest interface.

Please let me know of any breakage, regardless of the versions of Perl and File::Path you are using.

Thank you very much.

kid51

in reply to: ↑ 6   Changed 5 years ago by jkeenan

Replying to jkeenan:

I will take this ticket and revert all instances of File::Path::mkpath() to the oldest interface.

These reversions were committed to trunk in r39954 and r39955.

Please let me know of any breakage, regardless of the versions of Perl and File::Path you are using.

Will keep TT open for <= 3 days for reports of breakage.

Thank you very much.

kid51

in reply to: ↑ 6   Changed 5 years ago by jkeenan

Replying to jkeenan:

I will take this ticket and revert all instances of File::Path::mkpath() to the oldest interface.

These reversions were committed to trunk in r39954 and r39955.

Will keep TT open for <= 3 days for any reports of breakage.

  Changed 5 years ago by doughera

Thank you. I won't be able to test it anytime soon, but a quick look at the diffs looks fine. Go ahead and close it if you don't hear any complaints.

  Changed 5 years ago by mikehh

Since the original failure about 4 weeks age that I had with the latest version of File::Path on Perl 5.10 which was fixed by kid51++, subsequent modifications have not caused any problems with the t/steps tests where they failed for me. My latest tests as of r39965 all PASSed.

pre/post config, smolder, fulltest All PASS at r39965 - Ubuntu 9.04 amd64

Cheers, Michael (mikehh)

  Changed 5 years ago by jkeenan

  • status changed from assigned to closed
  • resolution set to fixed

Thanks, Michael. Closing ticket.

kid51

Note: See TracTickets for help on using tickets.