Debian Bug report logs - #496122
libfile-sharedir-perl: sharedir model changed

version graph

Package: libfile-sharedir-perl; Maintainer for libfile-sharedir-perl is Debian Perl Group <pkg-perl-maintainers@lists.alioth.debian.org>; Source for libfile-sharedir-perl is src:libfile-sharedir-perl.

Reported by: Ansgar Burchardt <ansgar@2008.43-1.org>

Date: Fri, 22 Aug 2008 19:39:04 UTC

Severity: grave

Tags: patch

Found in version libfile-sharedir-perl/0.05-1.1

Fixed in version libfile-sharedir-perl/0.05-1.2

Done: Damyan Ivanov <dmn@debian.org>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Christian Sánchez <csanchez@unplug.org.ve>:
Bug#496122; Package libfile-sharedir-perl. Full text and rfc822 format available.

Acknowledgement sent to Ansgar Burchardt <ansgar@2008.43-1.org>:
New Bug report received and forwarded. Copy sent to Christian Sánchez <csanchez@unplug.org.ve>. Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: Ansgar Burchardt <ansgar@2008.43-1.org>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: libfile-sharedir-perl: sharedir model changed
Date: Fri, 22 Aug 2008 21:33:35 +0200
Package: libfile-sharedir-perl
Version: 0.05-1.1
Severity: grave
Justification: renders package unusable

The directory layout used to store data has changed.  It now uses a flat
directory model:

    OLD: auto/dist/HTML/FormFu
    NEW: auto/dist/HTML-FormFu

This causes programs using recent versions of Module::Install (>= 0.76,
released on 17 Jul 2008) to fail when trying to locate files using
File::ShareDir.

The new upstream release 0.99_01 addresses this problem (and is
backwards compatible by looking into old-style paths if the new-style
path does not exist).

Regards,
Ansgar




Blocking bugs of 457583 added: 496122 Request was from Ansgar Burchardt <ansgar@43-1.org> to control@bugs.debian.org. (Fri, 22 Aug 2008 21:03:10 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Christian Sánchez <csanchez@unplug.org.ve>:
Bug#496122; Package libfile-sharedir-perl. Full text and rfc822 format available.

Acknowledgement sent to Ansgar Burchardt <ansgar@2008.43-1.org>:
Extra info received and forwarded to list. Copy sent to Christian Sánchez <csanchez@unplug.org.ve>. Full text and rfc822 format available.

Message #12 received at 496122@bugs.debian.org (full text, mbox):

From: Ansgar Burchardt <ansgar@2008.43-1.org>
To: debian-release@lists.debian.org, 496122@bugs.debian.org
Subject: new upstream version of libfile-sharedir-perl
Date: Wed, 27 Aug 2008 11:37:57 +0200
Hi,

libfile-sharedir-perl has a currently a grave bug because the directory
layout used to store data has changed.  This means the package is
unusable for Perl distributions whose name contains a "-" and
a recent Module::Install (>= 0.76, released on 17 Jul 2008 and included in
Lenny), see #496122.

This was fixed in version 0.99_01 (also released as 1.00 without
changes), which was released coordinated with Module::Install on
Jul 17th.

Besides updating tests and the build system (new version of
Module:Install) there are only two non-bugfix changes in the new
upstream release:
 * A new function `class_file' that will look for data
   files in the namespaces of parent classes (36 lines long), and
 * the other `*_file' functions will allow searching for any kind of
   path, not only regular files (changes some tests for (regular) files to
   tests if path exists)

As these other changes are not very large, I would like to know if the release
team would accept the new upstream release for Lenny instead of backporting the
fixes and updates to tests.

Regards,
Ansgar

Links to upstream tarballs:
  0.05 - http://search.cpan.org/CPAN/authors/id/A/AD/ADAMK/File-ShareDir-0.05.tar.gz
  1.00 - http://search.cpan.org/CPAN/authors/id/A/AD/ADAMK/File-ShareDir-1.00.tar.gz

Full changelog for upstream changes:

    1.00 Thu 17 Jul 2008
	    - Everything appears ok, release prod

    0.99_01 Thu 10 Jul 2009
	    - Updating tests a little
	    - Adding the class_file function
	    - Allow *_file to find any kind of path, not just files (hdp)
	    - Localising $@ during evals
	    - Implementing the new sharedir model

Diffstat between 0.05 and 1.00:

     Changes                        |   10
     MANIFEST                       |    7
     META.yml                       |   27 +
     Makefile.PL                    |   22 -
     README                         |   41 ++
     foo/test_file.txt              |    1
     inc/Module/Install.pm          |  437 ++++++++++++++++-----------
     inc/Module/Install/Base.pm     |    6
     inc/Module/Install/Can.pm      |    2
     inc/Module/Install/Fetch.pm    |    2
     inc/Module/Install/Makefile.pm |  333 +++++++++++----------
     inc/Module/Install/Metadata.pm |  650 +++++++++++++++++++++++++----------------
     inc/Module/Install/Share.pm    |   45 ++
     inc/Module/Install/Win32.pm    |   13
     inc/Module/Install/WriteAll.pm |   55 +--
     lib/File/ShareDir.pm           |  253 ++++++++++++++-
     share/subdir/sample.txt        |    7
     t/01_compile.t                 |   13
     t/02_main.t                    |   52 +--
     t/97_meta.t                    |   27 +
     t/98_pod.t                     |   32 ++
     t/99_pmv.t                     |   27 +
     t/99_pod.t                     |   36 --
     t/lib/ShareDir.pm              |   11
     24 files changed, 1385 insertions(+), 724 deletions(-)

 
Changes to lib/File/ShareDir.pm (minus documentation only hunks):
The internal function _dist_packfile is not used anywhere.

--- File-ShareDir-0.05/lib/File/ShareDir.pm	2006-09-04 02:52:56.000000000 +0200
+++ File-ShareDir-1.00/lib/File/ShareDir.pm	2008-07-17 09:58:40.000000000 +0200
@@ -104,22 +107,29 @@
 
 use 5.005;
 use strict;
-use base 'Exporter';
 use Carp             'croak';
+use Config           ();
+use Exporter         ();
 use File::Spec       ();
 use Params::Util     '_CLASS';
 use Class::Inspector ();
 
-use vars qw{$VERSION $IS_MACOS @EXPORT_OK %EXPORT_TAGS};
+use vars qw{$VERSION @ISA @EXPORT_OK %EXPORT_TAGS};
 BEGIN {
-	$VERSION     = '0.05';
-	$IS_MACOS    = $^O eq 'MacOS';
-	@EXPORT_OK   = qw{dist_dir dist_file module_dir module_file};
+	$VERSION     = '1.00';
+	@ISA         = qw{ Exporter };
+	@EXPORT_OK   = qw{
+		dist_dir dist_file
+		module_dir module_file
+		class_dir class_file
+	};
 	%EXPORT_TAGS = (
 		ALL => [ @EXPORT_OK ],
-		);	
+	);	
 }
 
+use constant IS_MACOS => !!($^O eq 'MacOS');
+
 
 
 
 The C<dist_dir> function takes a single parameter of the name of an
@@ -145,11 +155,49 @@
 
 sub dist_dir {
 	my $dist = _DIST(shift);
+	my $dir;
+
+	# Try the new version
+	$dir = _dist_dir_new( $dist );
+	return $dir if defined $dir;
+
+	# Fall back to the legacy version
+	$dir = _dist_dir_old( $dist );
+	return $dir if defined $dir;
+
+	# Ran out of options
+	croak("Failed to find share dir for dist '$dist'");
+}
+
+sub _dist_dir_new {
+	my $dist = shift;
+
+	# Create the subpath
+	my $path = File::Spec->catdir(
+		'auto', 'share', 'dist', $dist,
+	);
+
+	# Find the full dir withing @INC
+	foreach my $inc ( @INC ) {
+		next unless defined $inc and ! ref $inc;
+		my $dir = File::Spec->catdir( $inc, $path );
+		next unless -d $dir;
+		unless ( -r $dir ) {
+			croak("Found directory '$dir', but no read permissions");
+		}
+		return $dir;
+	}
+
+	return undef;
+}
+
+sub _dist_dir_old {
+	my $dist = shift;
 
 	# Create the subpath
 	my $path = File::Spec->catdir(
 		'auto', split( /-/, $dist ),
-		);
+	);
 
 	# Find the full dir withing @INC
 	foreach my $inc ( @INC ) {
@@ -157,13 +205,12 @@
 		my $dir = File::Spec->catdir( $inc, $path );
 		next unless -d $dir;
 		unless ( -r $dir ) {
-			croak("Directory '$dir', no read permissions");
+			croak("Found directory '$dir', but no read permissions");
 		}
 		return $dir;
 	}
 
-	# Couldn't find it
-	croak("Failed to find share dir for dist '$dist'");
+	return undef;
 }
 
 =pod
@@ -187,11 +234,46 @@
 
 sub module_dir {
 	my $module = _MODULE(shift);
+	my $dir;
+
+	# Try the new version
+	$dir = _module_dir_new( $module );
+	return $dir if defined $dir;
+
+	# Fall back to the legacy version
+	return _module_dir_old( $module );
+}
+
+sub _module_dir_new {
+	my $module = shift;
+
+	# Create the subpath
+	my $path = File::Spec->catdir(
+		'auto', 'share', 'module',
+		_module_subdir( $module ),
+	);
+
+	# Find the full dir withing @INC
+	foreach my $inc ( @INC ) {
+		next unless defined $inc and ! ref $inc;
+		my $dir = File::Spec->catdir( $inc, $path );
+		next unless -d $dir;
+		unless ( -r $dir ) {
+			croak("Found directory '$dir', but no read permissions");
+		}
+		return $dir;
+	}
+
+	return undef;
+}
+	
+sub _module_dir_old {
+	my $module = shift;
 	my $short  = Class::Inspector->filename($module);
 	my $long   = Class::Inspector->loaded_filename($module);
-	$short =~ tr{/} {:} if $IS_MACOS;
+	$short =~ tr{/}{:} if IS_MACOS;
 	substr( $short, -3, 3, '' );
-	$long  =~ m{^(.*)\Q$short\E\.pm\z}s or die("Failed to find base dir");
+	$long  =~ m/^(.*)\Q$short\E\.pm\z/s or die("Failed to find base dir");
 	my $dir = File::Spec->catdir( "$1", 'auto', $short );
 	unless ( -d $dir ) {
 		croak("Directory '$dir', does not exist");
@@ -199,7 +281,7 @@
 	unless ( -r $dir ) {
 		croak("Directory '$dir', no read permissions");
 	}
-	return $dir;		
+	return $dir;
 }
 
 =pod
@@ -226,16 +308,48 @@
 	my $dist = _DIST(shift);
 	my $file = _FILE(shift);
 
+	# Try the new version first
+	my $path = _dist_file_new( $dist, $file );
+	return $path if defined $path;
+
+	# Hand off to the legacy version
+	return _dist_file_old( $dist, $file );;
+}
+
+sub _dist_file_new {
+	my $dist = shift;
+	my $file = shift;
+
+	# If it exists, what should the path be
+	my $dir  = _dist_dir_new( $dist );
+	my $path = File::Spec->catfile( $dir, $file );
+
+	# Does the file exist
+	return undef unless -e $path;
+	unless ( -f $path ) {
+		croak("Found dist_file '$path', but not a file");
+	}
+	unless ( -r $path ) {
+		croak("File '$path', no read permissions");
+	}
+
+	return $path;
+}
+
+sub _dist_file_old {
+	my $dist = shift;
+	my $file = shift;
+
 	# Create the subpath
-	my $path = File::Spec->catdir(
+	my $path = File::Spec->catfile(
 		'auto', split( /-/, $dist ), $file,
-		);
+	);
 
 	# Find the full dir withing @INC
 	foreach my $inc ( @INC ) {
 		next unless defined $inc and ! ref $inc;
 		my $full = File::Spec->catdir( $inc, $path );
-		next unless -f $full;
+		next unless -e $full;
 		unless ( -r $full ) {
 			croak("Directory '$full', no read permissions");
 		}
@@ -274,7 +388,7 @@
 	my $file   = _FILE(shift);
 	my $dir    = module_dir($module);
 	my $path   = File::Spec->catfile($dir, $file);
-	unless ( -e $path and -f _ ) {
+	unless ( -e $path ) {
 		croak("File '$file' does not exist in module dir");
 	}
 	unless ( -r $path ) {
@@ -283,6 +397,71 @@
 	$path;
 }
 
+=pod
+
+=head2 class_file
+
+  # Find a file in our module shared dir, or in our parent class
+  my $dir = class_file('My::Module', 'file/name.txt');
+
+The C<module_file> function takes two params of the module name
+and file name. It locates the module dir, and then finds the file within
+it, verifying that the file actually exists, and that it is readable.
+
+In order to find the directory, the module B<must> be loaded when
+calling this function.
+
+The filename should be a relative path in the format of your local
+filesystem. It will simply added to the directory using L<File::Spec>'s
+C<catfile> method.
+
+If the file is NOT found for that module, C<class_file> will scan up
+the module's @ISA tree, looking for the file in all of the parent
+classes.
+
+This allows you to, in effect, "subclass" shared files.
+
+Returns the file path as a string, or dies if the file or the dist's
+directory cannot be located, or the file is not readable.
+
+=cut
+
+sub class_file {
+	my $module = _MODULE(shift);
+	my $file   = _FILE(shift);
+
+	# Get the super path ( not including UNIVERSAL )
+	# Rather than using Class::ISA, we'll use an inlined version
+	# that implements the same basic algorithm.
+	my @path  = ();
+	my @queue = ( $module );
+	my %seen  = ( $module => 1 );
+	while ( my $cl = shift @queue ) {
+		push @path, $cl;
+		no strict 'refs';
+		unshift @queue, grep { ! $seen{$_}++ }
+			map { s/^::/main::/; s/\'/::/g; $_ }
+			( @{"${cl}::ISA"} );
+	}
+
+	# Search up the path
+	foreach my $class ( @path ) {
+		local $@;
+		my $dir = eval {
+		 	module_dir($class);
+		};
+		next if $@;
+		my $path = File::Spec->catfile($dir, $file);
+		unless ( -e $path ) {
+			next;
+		}
+		unless ( -r $path ) {
+			croak("File '$file' cannot be read, no read permissions");
+		}
+		return $path;
+	}
+	croak("File '$file' does not exist in class or parent shared files");
+}
 
 
 
@@ -290,6 +469,35 @@
 #####################################################################
 # Support Functions
 
+sub _module_subdir {
+	my $module = shift;
+	$module =~ s/::/-/g;
+	return $module;
+}
+
+sub _dist_packfile {
+	my $module = shift;
+	my @dirs   = grep { -e } ( $Config::Config{archlibexp}, $Config::Config{sitearchexp} );
+	my $file   = File::Spec->catfile(
+		'auto', split( /::/, $module), '.packlist',
+	);
+
+	foreach my $dir ( @dirs ) {
+		my $path = File::Spec->catfile( $dir, $file );
+		next unless -f $path;
+
+		# Load the file
+		my $packlist = ExtUtils::Packlist->new($path);
+		unless ( $packlist ) {
+			die "Failed to load .packlist file for $module";
+		}
+
+		die "CODE INCOMPLETE";
+	}
+
+	die "CODE INCOMPLETE";
+}
+
 # Matches a valid distribution name
 ### This is a total guess at this point
 sub _DIST {
 

-- 
PGP: 1024D/595FAD19  739E 2D09 0969 BEA9 9797  B055 DDB0 2FF7 595F AD19





Information forwarded to debian-bugs-dist@lists.debian.org, Christian Sánchez <csanchez@unplug.org.ve>:
Bug#496122; Package libfile-sharedir-perl. Full text and rfc822 format available.

Acknowledgement sent to Marc 'HE' Brockschmidt <he@ftwca.de>:
Extra info received and forwarded to list. Copy sent to Christian Sánchez <csanchez@unplug.org.ve>. Full text and rfc822 format available.

Message #17 received at 496122@bugs.debian.org (full text, mbox):

From: Marc 'HE' Brockschmidt <he@ftwca.de>
To: Ansgar Burchardt <ansgar@2008.43-1.org>
Cc: debian-release@lists.debian.org, 496122@bugs.debian.org
Subject: Re: new upstream version of libfile-sharedir-perl
Date: Sat, 13 Sep 2008 23:10:26 +0200
[Message part 1 (text/plain, inline)]
Ansgar Burchardt <ansgar@2008.43-1.org> writes:
> As these other changes are not very large, I would like to know if the release
> team would accept the new upstream release for Lenny instead of backporting the
> fixes and updates to tests.

We would prefer a minimal update over the current version instead of a
complete new upstream version with such massive changes. Could you
prepare a patch for the version currently in lenny?

Marc
[Message part 2 (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Christian Sánchez <csanchez@unplug.org.ve>:
Bug#496122; Package libfile-sharedir-perl. Full text and rfc822 format available.

Message #20 received at 496122@bugs.debian.org (full text, mbox):

From: pkg-perl-maintainers@lists.alioth.debian.org
To: 496122@bugs.debian.org, 496122-submitter@bugs.debian.org
Subject: Bug in libfile-sharedir-perl fixed in revision 25155
Date: Sun, 14 Sep 2008 22:46:45 +0000
tag 496122 + pending
thanks

Some bugs are closed in revision 25155
by Damyan Ivanov (dmn)

Commit message:

      TODO: investigate the warning during testsuite
* Non-maintainer upload.
* add fix-dist-path.patch, fixing a regression in shared directory layout.
  Closes: #496122




Tags added: pending Request was from pkg-perl-maintainers@lists.alioth.debian.org to control@bugs.debian.org. (Sun, 14 Sep 2008 22:48:03 GMT) Full text and rfc822 format available.

Message sent on to Ansgar Burchardt <ansgar@2008.43-1.org>:
Bug#496122. Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Christian Sánchez <csanchez@unplug.org.ve>:
Bug#496122; Package libfile-sharedir-perl. Full text and rfc822 format available.

Message #28 received at 496122@bugs.debian.org (full text, mbox):

From: Damyan Ivanov <dmn@debian.org>
To: 496122@bugs.debian.org
Cc: debian-perl@lists.debian.org
Subject: libfile-sharedir-perl: diff for NMU version 0.05-1.2
Date: Mon, 15 Sep 2008 09:35:01 +0300
[Message part 1 (text/plain, inline)]
tags 496122 + patch
thanks

Hi,

Attached is the diff for my libfile-sharedir-perl 0.05-1.2 NMU.

It closes a grave regression in 0.05 that is fixed upstream in 1.00.  
However, new upstream releases are inappropriate for Lenny, hence the 
fix was backported.

Please consider offering the package for adoption. Debian Perl Group 
is willing to take over. Mail debian-perl@lists.debian.org (cc-ed) or 
come say hello on #debian-perl.

-- 
dam            JabberID: dam@jabber.minus273.org
[libfile-sharedir-perl-0.05-1.2-nmu.diff (text/x-diff, attachment)]
[signature.asc (application/pgp-signature, inline)]

Tags added: patch Request was from Damyan Ivanov <dmn@debian.org> to control@bugs.debian.org. (Mon, 15 Sep 2008 06:36:08 GMT) Full text and rfc822 format available.

Reply sent to Damyan Ivanov <dmn@debian.org>:
You have taken responsibility. Full text and rfc822 format available.

Notification sent to Ansgar Burchardt <ansgar@2008.43-1.org>:
Bug acknowledged by developer. Full text and rfc822 format available.

Message #35 received at 496122-close@bugs.debian.org (full text, mbox):

From: Damyan Ivanov <dmn@debian.org>
To: 496122-close@bugs.debian.org
Subject: Bug#496122: fixed in libfile-sharedir-perl 0.05-1.2
Date: Mon, 15 Sep 2008 09:17:10 +0000
Source: libfile-sharedir-perl
Source-Version: 0.05-1.2

We believe that the bug you reported is fixed in the latest version of
libfile-sharedir-perl, which is due to be installed in the Debian FTP archive:

libfile-sharedir-perl_0.05-1.2.diff.gz
  to pool/main/libf/libfile-sharedir-perl/libfile-sharedir-perl_0.05-1.2.diff.gz
libfile-sharedir-perl_0.05-1.2.dsc
  to pool/main/libf/libfile-sharedir-perl/libfile-sharedir-perl_0.05-1.2.dsc
libfile-sharedir-perl_0.05-1.2_all.deb
  to pool/main/libf/libfile-sharedir-perl/libfile-sharedir-perl_0.05-1.2_all.deb



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 496122@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Damyan Ivanov <dmn@debian.org> (supplier of updated libfile-sharedir-perl package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.8
Date: Mon, 15 Sep 2008 09:12:06 +0300
Source: libfile-sharedir-perl
Binary: libfile-sharedir-perl
Architecture: source all
Version: 0.05-1.2
Distribution: unstable
Urgency: high
Maintainer: Christian Sánchez <csanchez@unplug.org.ve>
Changed-By: Damyan Ivanov <dmn@debian.org>
Description: 
 libfile-sharedir-perl - Locate per-dist and per-module shared files
Closes: 496122
Changes: 
 libfile-sharedir-perl (0.05-1.2) unstable; urgency=high
 .
   * Non-maintainer upload.
   * add fix-dist-path.patch, fixing a regression in shared directory layout.
     Closes: #496122
Checksums-Sha1: 
 3fd6a112bc0666935a4d5423acea37197243ea63 1211 libfile-sharedir-perl_0.05-1.2.dsc
 5739c20a322be44350a9f4a940b98d1cee466709 2881 libfile-sharedir-perl_0.05-1.2.diff.gz
 615462e1f5c25f7b3e75e1dbb28bad457674ad75 13326 libfile-sharedir-perl_0.05-1.2_all.deb
Checksums-Sha256: 
 803d1dbeabbc3ef098835fd557299475029239ad2a5d673adcd9599e8129cac9 1211 libfile-sharedir-perl_0.05-1.2.dsc
 51ebcc88939a8ed9c456e583d12a71a30dd2b33f930a3e0855851d5925700a2b 2881 libfile-sharedir-perl_0.05-1.2.diff.gz
 ef750af3c1d9295762d77051dccf55232accfb0aa9f9ee4ac5e91f8356c3f7be 13326 libfile-sharedir-perl_0.05-1.2_all.deb
Files: 
 427dca50eecde69ebb3d3e4a02713624 1211 perl optional libfile-sharedir-perl_0.05-1.2.dsc
 153f22d337151ee8e36f38722e864357 2881 perl optional libfile-sharedir-perl_0.05-1.2.diff.gz
 c20f1b6363cebd89e5ae3281085043a6 13326 perl optional libfile-sharedir-perl_0.05-1.2_all.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkjOH4oACgkQHqjlqpcl9jvR1QCgnuYujKQ6A0s79uHPfrzVsDGz
RuYAoLQby8rfgt9z3wOm8d9Zln9IkSOv
=JYPf
-----END PGP SIGNATURE-----





Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Mon, 20 Oct 2008 07:27:24 GMT) Full text and rfc822 format available.

Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Mon Apr 21 16:42:40 2014; Machine Name: beach.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.