Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.99k stars 559 forks source link

CPAN configuration failed #4207

Closed p5pRT closed 22 years ago

p5pRT commented 23 years ago

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

Searchable as RT7275$

p5pRT commented 23 years ago

From rmb1@cise.npl.co.uk

Created by rmb1@cise.npl.co.uk

When I ran CPAN shell a la cpan\, I got the following error. The comment in the code which call the error message says this "Should never happen" !

Robin

% perl5.7.2 -MCPAN -e shell Cannot open >/home/rmb1/.cpan/CPAN/MyConfig.pm at /opt/perl/lib/5.7.2/CPAN.pm line 1156   CPAN​::Config​::load('CPAN​::Config') called at /opt/perl/lib/5.7.2/CPAN.pm line 88   CPAN​::shell() called at -e line 1

Perl Info ``` Flags: category=library severity=medium This perlbug was built using Perl v5.6.1 - Mon Apr 9 14:50:07 BST 2001 It is being executed now by Perl v5.7.2 - Fri Jul 13 16:39:28 BST 2001. Site configuration information for perl v5.7.2: Configured by rmb1 at Fri Jul 13 16:39:28 BST 2001. Summary of my perl5 (revision 5.0 version 7 subversion 2) configuration: Platform: osname=solaris, osvers=2.7, archname=sun4-solaris-64int uname='sunos tempest 5.7 generic_106541-04 sun4u sparc sunw,ultra-5_10 ' config_args='-Dcc=gcc -Dcf_email=rmb1@cise.npl.co.uk -Dman1dir=none -Dman3dir=none -Doptimize=-O -g -Dprefix=/opt/perl -Duse64bitint -Dversiononly -Dusedevel' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=define use64bitall=undef uselongdouble=undef Compiler: cc='gcc', ccflags ='-Wall -DDEBUGGING -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-O -g', cppflags='-Wall -DDEBUGGING -fno-strict-aliasing -I/usr/local/include' ccversion='', gccversion='2.95.2 19991024 (release)', gccosandvers='solaris2.7' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=87654321 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, usemymalloc=n, prototype=define, bincompat5005=define Linker and Libraries: ld='gcc', ldflags =' -L/usr/local/lib ' libpth=/usr/local/lib /usr/lib /usr/ccs/lib libs=-lsocket -lnsl -ldb -ldl -lm -lc perllibs=-lsocket -lnsl -ldl -lm -lc libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' ' cccdlflags='-fPIC', lddlflags='-G -L/usr/local/lib' Locally applied patches: @INC for perl v5.7.2: /home/rmb1/appl/lib/perl5/site_perl/5.6.1 /home/rmb1/appl/lib/perl5/site_perl/5.6.0/sun4-solaris-64int /home/rmb1/appl/lib/perl5/site_perl/5.6.0 /home/rmb1/appl/lib/perl5/site_perl/5.005 /home/rmb1/appl/lib/perl5/site_perl /home/rmb1/appl/lib/perl5/site_perl/5.005 /opt/perl/lib/5.7.2/sun4-solaris-64int /opt/perl/lib/5.7.2 /opt/perl/lib/site_perl/5.7.2/sun4-solaris-64int /opt/perl/lib/site_perl/5.7.2 /opt/perl/lib/site_perl/5.6.1 /opt/perl/lib/site_perl/5.6.0/sun4-solaris-64int /opt/perl/lib/site_perl/5.6.0 /opt/perl/lib/site_perl/5.005 /opt/perl/lib/site_perl . Environment for perl v5.7.2: HOME=/home/rmb1 LANG=C LANGUAGE (unset) LD_LIBRARY_PATH=/usr/lib LOGDIR (unset) PATH=/opt/perl/bin:/home/rmb1/appl/script:/opt/SUNWspci/bin/:/usr/tempest/bin:/usr/local/bin:/usr/local/Admigration/exec:/usr/local/hotjava/bin:/usr/openwin/bin:/usr/dt/bin:/usr/ccs/bin:/usr/bin PERL5LIB=/home/rmb1/appl/lib/perl5/site_perl:/home/rmb1/appl/lib/perl5/site_perl/5.005 PERL_BADLANG (unset) SHELL=/bin/csh ```
p5pRT commented 22 years ago

From [Unknown Contact. See original ticket]

This bug occurs when an installed perl does not have CPAN/Config.pm and a user runs cpan when he can not create CPAN/Config.pm and has a read only MyConfig.pm (my MyConfig.pm is under RCS).

I have included a patch which merges some (attemptedly) repeated code\, so that a change made to the first repeat also occurs in the second\, which fixes this bug.

Robin

From perlbug@​rfi.net Mon Jan 28 13​:05​:37 2002 Date​: 28 Jan 2002 13​:05​:33 -0000 From​: perlbug@​onion.perl.org Subject​: Perlbug - reminder of bug(20010713.003) status X-Errors-To​: perlbug@​rfi.net To​: rmb1@​cise.npl.co.uk X-Perlbug​: Perlbug(tron) v2.92 Content-Length​: 1085

This is a Perlbug status\(open\) reminder for an outstanding 
bug\, a report for which is appended at the base of this email\.

If the the status of this bug is in any way incorrect\, please
inform an administrator of the Perlbug system\.

Further data relating to this bug\(20010713\.003\) may be found at​:

    http​://bugs\.perl\.org/index\.html/perlbug\.cgi?req=bidmid&bidmid=20010713\.003

The group\(library\) of administrators responsible for this bug is​:

    http​://bugs\.perl\.org/index\.html/perlbug\.cgi?req=group\_id&group\_id=2

For email help send an email to​:

    To​: bugdb@​perl\.org
    Subject​: \-H

Bug report \(current status\) follows​:

Bug​: 20010713.003
Subject​: CPAN configuration failed From​: Robin Barker \rmb1@​cise\.npl\.co\.uk Created​: 2001-07-13 09​:50​:41 Modified​: 2001-07-13 09​:50​:41

Status​: open Severity​: medium OS names​: solaris Group​: library Version​: Fixed in​:

Message ids​: 0
Patch ids​: 0
Test ids​: 0
Note ids​: 0
Change ids​: 0
Parent ids​: 0
Child ids​: 0
Address ids​: 1

Patch​: --- lib/CPAN.pm
+++ lib/CPAN.pm @​@​ -1095\,6 +1095\,36 @​@​   1; }

+# This is a piece of repeated code that is abstracted here for +# maintainability. RMB +# +sub _configpmtest { + my($configpmdir\, $configpmtest) = @​_; + if (-w $configpmtest) { + return $configpmtest; + } elsif (-w $configpmdir) { + #_#_# following code dumped core on me with 5.003_11\, a.k. + my $configpm_bak = "$configpmtest.bak"; + unlink $configpm_bak if -f $configpm_bak; + if( -f $configpmtest ) {
+ if( rename $configpmtest\, $configpm_bak ) {
+ $CPAN​::Frontend->mywarn(\<\<END) +Old configuration file $configpmtest + moved to $configpm_bak +END + } + }
+ my $fh = FileHandle->new; + if ($fh->open(">$configpmtest")) { + $fh->print("1;\n"); + return $configpmtest; + } else { + # Should never happen + Carp​::confess("Cannot open >$configpmtest"); + } + } else { return } +} + #-> sub CPAN​::Config​::load ; sub load {   my($self) = shift; @​@​ -1125\,39 +1155\,14 @​@​   my($configpmdir) = File​::Spec->catdir($path_to_cpan\,"CPAN");   my($configpmtest) = File​::Spec->catfile($configpmdir\,"Config.pm");   if (-d $configpmdir or File​::Path​::mkpath($configpmdir)) { - if (-w $configpmtest) { - $configpm = $configpmtest; - } elsif (-w $configpmdir) { - #_#_# following code dumped core on me with 5.003_11\, a.k. - unlink "$configpmtest.bak" if -f "$configpmtest.bak"; - rename $configpmtest\, "$configpmtest.bak" if -f $configpmtest; - my $fh = FileHandle->new; - if ($fh->open(">$configpmtest")) { - $fh->print("1;\n"); - $configpm = $configpmtest; - } else { - # Should never happen - Carp​::confess("Cannot open >$configpmtest"); - } - } + $configpm = _configpmtest($configpmdir\,$configpmtest);   }   unless ($configpm) {   $configpmdir = File​::Spec->catdir($ENV{HOME}\,".cpan"\,"CPAN");   File​::Path​::mkpath($configpmdir);   $configpmtest = File​::Spec->catfile($configpmdir\,"MyConfig.pm"); - if (-w $configpmtest) { - $configpm = $configpmtest; - } elsif (-w $configpmdir) { - #_#_# following code dumped core on me with 5.003_11\, a.k. - my $fh = FileHandle->new; - if ($fh->open(">$configpmtest")) { - $fh->print("1;\n"); - $configpm = $configpmtest; - } else { - # Should never happen - Carp​::confess("Cannot open >$configpmtest"); - } - } else { + $configpm = _configpmtest($configpmdir\,$configpmtest); + unless ($configpm) {   Carp​::confess(qq{WARNING​: CPAN.pm is unable to }.   qq{create a configuration file.});   } End of patch

-- Robin Barker | Email​: Robin.Barker@​npl.co.uk CMSC\, Building 10\, | Phone​: +44 (0) 20 8943 7090 National Physical Laboratory\, | Fax​: +44 (0) 20 8977 7091 Teddington\, Middlesex\, UK. TW11 OLW | WWW​: http​://www.npl.co.uk

p5pRT commented 22 years ago

From [Unknown Contact. See original ticket]

This bug occurs when an installed perl does not have CPAN/Config.pm and a user runs cpan when he can not create CPAN/Config.pm and has a read only MyConfig.pm (my MyConfig.pm is under RCS).

I have included a patch which merges some (attemptedly) repeated code\, so that a change made to the first repeat also occurs in the second\, which fixes this bug.

Robin

From perlbug@​rfi.net Mon Jan 28 13​:05​:37 2002 Date​: 28 Jan 2002 13​:05​:33 -0000 From​: perlbug@​onion.perl.org Subject​: Perlbug - reminder of bug(20010713.003) status X-Errors-To​: perlbug@​rfi.net To​: rmb1@​cise.npl.co.uk X-Perlbug​: Perlbug(tron) v2.92 Content-Length​: 1085

This is a Perlbug status\(open\) reminder for an outstanding 
bug\, a report for which is appended at the base of this email\.

If the the status of this bug is in any way incorrect\, please
inform an administrator of the Perlbug system\.

Further data relating to this bug\(20010713\.003\) may be found at&#8203;:

    http&#8203;://bugs\.perl\.org/index\.html/perlbug\.cgi?req=bidmid&bidmid=20010713\.003

The group\(library\) of administrators responsible for this bug is&#8203;:

    http&#8203;://bugs\.perl\.org/index\.html/perlbug\.cgi?req=group\_id&group\_id=2

For email help send an email to&#8203;:

    To&#8203;: bugdb@&#8203;perl\.org
    Subject&#8203;: \-H

Bug report \(current status\) follows&#8203;:

Bug​: 20010713.003
Subject​: CPAN configuration failed From​: Robin Barker \rmb1@&#8203;cise\.npl\.co\.uk Created​: 2001-07-13 09​:50​:41 Modified​: 2001-07-13 09​:50​:41

Status​: open Severity​: medium OS names​: solaris Group​: library Version​: Fixed in​:

Message ids​: 0
Patch ids​: 0
Test ids​: 0
Note ids​: 0
Change ids​: 0
Parent ids​: 0
Child ids​: 0
Address ids​: 1

Patch​: --- lib/CPAN.pm
+++ lib/CPAN.pm @​@​ -1095\,6 +1095\,36 @​@​   1; }

+# This is a piece of repeated code that is abstracted here for +# maintainability. RMB +# +sub _configpmtest { + my($configpmdir\, $configpmtest) = @​_; + if (-w $configpmtest) { + return $configpmtest; + } elsif (-w $configpmdir) { + #_#_# following code dumped core on me with 5.003_11\, a.k. + my $configpm_bak = "$configpmtest.bak"; + unlink $configpm_bak if -f $configpm_bak; + if( -f $configpmtest ) {
+ if( rename $configpmtest\, $configpm_bak ) {
+ $CPAN​::Frontend->mywarn(\<\<END) +Old configuration file $configpmtest + moved to $configpm_bak +END + } + }
+ my $fh = FileHandle->new; + if ($fh->open(">$configpmtest")) { + $fh->print("1;\n"); + return $configpmtest; + } else { + # Should never happen + Carp​::confess("Cannot open >$configpmtest"); + } + } else { return } +} + #-> sub CPAN​::Config​::load ; sub load {   my($self) = shift; @​@​ -1125\,39 +1155\,14 @​@​   my($configpmdir) = File​::Spec->catdir($path_to_cpan\,"CPAN");   my($configpmtest) = File​::Spec->catfile($configpmdir\,"Config.pm");   if (-d $configpmdir or File​::Path​::mkpath($configpmdir)) { - if (-w $configpmtest) { - $configpm = $configpmtest; - } elsif (-w $configpmdir) { - #_#_# following code dumped core on me with 5.003_11\, a.k. - unlink "$configpmtest.bak" if -f "$configpmtest.bak"; - rename $configpmtest\, "$configpmtest.bak" if -f $configpmtest; - my $fh = FileHandle->new; - if ($fh->open(">$configpmtest")) { - $fh->print("1;\n"); - $configpm = $configpmtest; - } else { - # Should never happen - Carp​::confess("Cannot open >$configpmtest"); - } - } + $configpm = _configpmtest($configpmdir\,$configpmtest);   }   unless ($configpm) {   $configpmdir = File​::Spec->catdir($ENV{HOME}\,".cpan"\,"CPAN");   File​::Path​::mkpath($configpmdir);   $configpmtest = File​::Spec->catfile($configpmdir\,"MyConfig.pm"); - if (-w $configpmtest) { - $configpm = $configpmtest; - } elsif (-w $configpmdir) { - #_#_# following code dumped core on me with 5.003_11\, a.k. - my $fh = FileHandle->new; - if ($fh->open(">$configpmtest")) { - $fh->print("1;\n"); - $configpm = $configpmtest; - } else { - # Should never happen - Carp​::confess("Cannot open >$configpmtest"); - } - } else { + $configpm = _configpmtest($configpmdir\,$configpmtest); + unless ($configpm) {   Carp​::confess(qq{WARNING​: CPAN.pm is unable to }.   qq{create a configuration file.});   } End of patch

-- Robin Barker | Email​: Robin.Barker@​npl.co.uk CMSC\, Building 10\, | Phone​: +44 (0) 20 8943 7090 National Physical Laboratory\, | Fax​: +44 (0) 20 8977 7091 Teddington\, Middlesex\, UK. TW11 OLW | WWW​: http​://www.npl.co.uk

p5pRT commented 22 years ago

From @jhi

On Wed\, Jan 30\, 2002 at 11​:58​:33AM +0000\, Robin Barker wrote​:

This bug occurs when an installed perl does not have CPAN/Config.pm and a user runs cpan when he can not create CPAN/Config.pm and has a read only MyConfig.pm (my MyConfig.pm is under RCS).

I have included a patch which merges some (attemptedly) repeated code\, so that a change made to the first repeat also occurs in the second\, which fixes this bug.

Thanks\, applied.

-- $jhi++; # http​://www.iki.fi/jhi/   # There is this special biologist word we use for 'stable'.   # It is 'dead'. -- Jack Cohen

p5pRT commented 22 years ago

From @jhi

On Wed\, Jan 30\, 2002 at 11​:58​:33AM +0000\, Robin Barker wrote​:

This bug occurs when an installed perl does not have CPAN/Config.pm and a user runs cpan when he can not create CPAN/Config.pm and has a read only MyConfig.pm (my MyConfig.pm is under RCS).

I have included a patch which merges some (attemptedly) repeated code\, so that a change made to the first repeat also occurs in the second\, which fixes this bug.

Thanks\, applied.

-- $jhi++; # http​://www.iki.fi/jhi/   # There is this special biologist word we use for 'stable'.   # It is 'dead'. -- Jack Cohen

p5pRT commented 22 years ago

From [Unknown Contact. See original ticket]

Robin Barker wrote​: [snip]

+ my $fh = FileHandle->new; + if ($fh->open(">$configpmtest")) { + $fh->print("1;\n");

I'm just a bit curious... is there any reason you're using FileHandle\, rather than IO​::File ?

-- There's a wild Fandango loose in the theater!

p5pRT commented 22 years ago

From [Unknown Contact. See original ticket]

Robin Barker wrote​: [snip]

+ my $fh = FileHandle->new; + if ($fh->open(">$configpmtest")) { + $fh->print("1;\n");

I'm just a bit curious... is there any reason you're using FileHandle\, rather than IO​::File ?

It was in the piece of repeated code I copies and unrepeated.

The rest of CPAN.pm use FileHandle rather than IO​::* no doubt for histerical (and supposed backward compatibility) raisins.

Robin

-- Robin Barker | Email​: Robin.Barker@​npl.co.uk CMSC\, Building 10\, | Phone​: +44 (0) 20 8943 7090 National Physical Laboratory\, | Fax​: +44 (0) 20 8977 7091 Teddington\, Middlesex\, UK. TW11 OLW | WWW​: http​://www.npl.co.uk

p5pRT commented 22 years ago

From rmb1@cise.npl.co.uk

Fixed by patch supplied by Robin Barker\, applied by Jarkko

p5pRT commented 22 years ago

rmb1@cise.npl.co.uk - Status changed from 'open' to 'resolved'