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

CPAN.pm crashes if off-line #1924

Closed
p5pRT opened this issue May 2, 2000 · 4 comments
Closed

CPAN.pm crashes if off-line #1924

p5pRT opened this issue May 2, 2000 · 4 comments

Comments

@p5pRT
Copy link

p5pRT commented May 2, 2000

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

Searchable as RT3194$

@p5pRT
Copy link
Author

p5pRT commented May 2, 2000

From ian@dial.pipex.com

Created by ian@homer.dial.pipex.com

Attempting to restart CPAN on a new 5.6.0 installation, I was asked for config
questions, then this happened​:

....
Your no_proxy?
Your /home/ian/.cpan/sources/MIRRORED.BY is older than 60 days,
  I'm trying to fetch one
CPAN​: LWP​::UserAgent loaded ok
Fetching with LWP​:
  ftp​://sunsite.doc.ic.ac.uk/packages/CPAN/MIRRORED.BY
Fetching with LWP​:
  ftp​://sunsite.doc.ic.ac.uk/packages/CPAN/MIRRORED.BY.gz
Fetching with Net​::FTP​:
  ftp​://sunsite.doc.ic.ac.uk/packages/CPAN/MIRRORED.BY
Can't locate object method "new" via package "Net​::FTP" at /usr/local/lib/perl5/5.6.0/CPAN.pm line 1860.

CPAN picked up the LWP from a site_perl directory, but it didn't work, so it
tried to try Net​::FTP - but evidently without it being loaded. I don't recall
ever using Net​::FTP directly, and if I do​:

~ % perl -MNet​::FTP -e 1;
Can't locate Net/Config.pm in @​INC (@​INC contains​: /u2/ian/lib/perl5 /usr/local/lib/perl5/5.6.0/i686-linux /usr/local/lib/perl5/5.6.0 /usr/local/lib/perl5/site_perl/5.6.0/i686-linux /usr/local/lib/perl5/site_perl/5.6.0 /usr/local/lib/perl5/site_perl .) at /usr/local/lib/perl5/site_perl/Net/FTP.pm line 21.
BEGIN failed--compilation aborted at /usr/local/lib/perl5/site_perl/Net/FTP.pm line 21.

Hmm.. we have
/usr/local/lib/perl5/site_perl/Net/FTP.pm
but​:
/usr/local/lib/perl5/site_perl/i586-linux/Net/Config.pm

... so Net​::FTP stops working because I upgraded my processor :-(

Maybe [1] Net​::FTP's travails aren't a concern of perl5-porters; however the
bug I'm reporting is that CPAN.pm maybe needs to have an "eval{}" or two
to protect against this sort of thing.

... hmm... actually, the problem is more subtle.

If you do 'eval{require Net​::FTP}' on my machine, the first time it
returns undef. Call a second time in the same program, and it returns 1 -
presumably because the first load was partly successful, so that
$INC{"Net/FTP.pm"} is set.

There's a case for saying this is a bug in 'require' - the module
reported that it failed to load, but perl still records it in %INC as
having loaded.

Hence CPAN​::META​::has_inst() is unwise to rely on the return code from
"require" unless it's *sure* it hasn't failed to load the module
previously.

I'm not going to venture a patch just yet, since this looks b*y
complicated to me - it's in order for CPAN.pm to retry Net​::FTP if it
just installed it, for instance. But CPAN.pm does have to be aware that
"require" doesn't do quite what it wants, whether by design or by bug.

(Footnote​: I can't help feeling that, if CPAN.pm is in the core
distribution, then so should enough code that it can bootstrap itself
without external crutches. Whether this is the existing Net​::FTP, or
LWP​::*, or a stripped-down version, is discussable.)

Oh, and I've now discovered CPAN​::Nox, so don't bother telling me about it.

Ian

Perl Info

Flags:
    category=library
    severity=medium

Site configuration information for perl v5.6.0:

Configured by ian at Mon May  1 21:14:37 BST 2000.

Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
  Platform:
    osname=linux, osvers=2.0.34, archname=i686-linux
    uname='linux homer 2.0.34 #4 fri apr 30 17:59:32 bst 1999 i686 unknown '
    config_args='-der'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=undef d_sfio=undef uselargefiles=define 
    use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef
  Compiler:
    cc='cc', optimize='-O2', gccversion=egcs-2.90.29 980515 (egcs-1.0.3 release)
    cppflags='-I/usr/local/include'
    ccflags ='-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
    stdchar='char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=4
    alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lndbm -lgdbm -ldbm -ldb -ldl -lm -lc
    libc=, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:
    


@INC for perl v5.6.0:
    /u2/ian/lib/perl5
    /usr/local/lib/perl5/5.6.0/i686-linux
    /usr/local/lib/perl5/5.6.0
    /usr/local/lib/perl5/site_perl/5.6.0/i686-linux
    /usr/local/lib/perl5/site_perl/5.6.0
    /usr/local/lib/perl5/site_perl
    .


Environment for perl v5.6.0:
    HOME=/u2/ian
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/u2/ian/cmd:/u2/ian/Linux:/usr/local/bin:/u2/ian/stocks/cmd:/usr/openwin/bin:/usr/bin/X11:/usr/bin:/bin:/usr/lib/teTeX/bin:/usr/etc:/sbin:/usr/sbin
    PERL5LIB=/u2/ian/lib/perl5
    PERL_BADLANG (unset)
    SHELL=/bin/zsh


@p5pRT
Copy link
Author

p5pRT commented Jun 16, 2000

From @andk

On Tue, 2 May 2000 12​:20​:59 +0100, Ian Phillipps <ian@​dial.pipex.com> said​:

Fetching with Net​::FTP​:
ftp​://sunsite.doc.ic.ac.uk/packages/CPAN/MIRRORED.BY
Can't locate object method "new" via package "Net​::FTP" at /usr/local/lib/perl5/5.6.0/CPAN.pm line 1860.

[...details snipped...]

Thanks for the insightful bugreport. Will be fixed in the next version
(or at least a fix is attempted) by introducing a has_usable() method
that is pickier than has_inst(). has_usable() is tunable should it
fail.

(Footnote​: I can't help feeling that, if CPAN.pm is in the core
distribution, then so should enough code that it can bootstrap itself
without external crutches. Whether this is the existing Net​::FTP, or
LWP​::*, or a stripped-down version, is discussable.)

CC'd to Graham Barr. Maybe now that Net​::FTP seems to have reached a
pretty stable state, it would be doable to include it in the core?

@p5pRT
Copy link
Author

p5pRT commented Jun 17, 2000

From @gbarr

On Sat, Jun 17, 2000 at 08​:11​:41AM +0200, Andreas J. Koenig wrote​:

(Footnote​: I can't help feeling that, if CPAN.pm is in the core
distribution, then so should enough code that it can bootstrap itself
without external crutches. Whether this is the existing Net​::FTP, or
LWP​::*, or a stripped-down version, is discussable.)

CC'd to Graham Barr. Maybe now that Net​::FTP seems to have reached a
pretty stable state, it would be doable to include it in the core?

We have been here before and stability was never the issue. See the archives

Graham.

@p5pRT
Copy link
Author

p5pRT commented Nov 10, 2000

From The RT System itself

The ChangeLog of CPAN.pm that comes with the
standalone CPAN.pm distribution states​:

2000-06-17 Andreas J. Koenig <andreas.koenig@​anima.de>

  * Introduced has_usable which is pickier than has_inst. Thanks to
  a report by Ian Phillipps who reported the Net​::FTP/Net​::Config
  connection​: e.g. upgrading the processor deprecates Net​::Config
  but not Net​::FTP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant