Skip Menu |

This queue is for tickets about the CPAN CPAN distribution.

Report information
The Basics
Id: 128063
Status: open
Priority: 0/
Queue: CPAN

People
Owner: Nobody in particular
Requestors: bill.cattey [...] gmail.com
Cc: CAC [...] cpan.org
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: MacOS 10.13 looks for gzip in /opt/local/bin not /usr/bin
From: bill.cattey [...] gmail.com
(I'm new to RT and not being efficient about getting this submission right. Sorry.) In using cpan to perform an install of the cpanm module It worked fine under Mac OS 10.11, but after updating to 10.13, the cpanm install seemed to succeed, but actually failed, and root cause was that it was failing to find /opt/local/bin/gzip. I originally thought root cause would like in the cpanm manifest, and opened a bug there. But I was told that the problem is with cpan. (I will include platform and version info at the bottom of this note.) There are two problems: It should find gzip in /usr/bin/gzip, and not blow out failing to find it in /opt/local/bin/gzip It should say that it failed, not end with the misleading: " /usr/bin/make install -- OK" Output of failed run: wdc-home2:~ wdc$ sudo cpan install App::cpanminus Password: Reading '/Users/wdc/.cpan/Metadata' Database was generated on Sun, 16 Dec 2018 10:17:03 GMT Running install for module 'App::cpanminus' Running make for M/MI/MIYAGAWA/App-cpanminus-1.7044.tar.gz Checksum for /Users/wdc/.cpan/sources/authors/id/M/MI/MIYAGAWA/App-cpanminus-1.7044.tar.gz ok sh: /opt/local/bin/gzip: No such file or directory Package seems to come without Makefile.PL. (The test -f "/Users/wdc/.cpan/build/MIYAGAWA-zGPbQP/Makefile.PL" returned false.) Writing one on our own (setting NAME to Appcpanminus) CPAN.pm: Building M/MI/MIYAGAWA/App-cpanminus-1.7044.tar.gz Generating a Unix-style Makefile Writing Makefile for Appcpanminus Writing MYMETA.yml and MYMETA.json MIYAGAWA/App-cpanminus-1.7044.tar.gz /usr/bin/make -- OK 'YAML' not installed, will not store persistent state Running make test No tests defined for Appcpanminus extension. MIYAGAWA/App-cpanminus-1.7044.tar.gz /usr/bin/make test -- OK Running make install Appending installation info to /Library/Perl/Updates/5.18.2/darwin-thread-multi-2level/perllocal.pod MIYAGAWA/App-cpanminus-1.7044.tar.gz /usr/bin/make install -- OK Proof of failure (in another terminal window): wdc-home2:trunk wdc$ sudo cpanm --installdeps . sudo: cpanm: command not found Corrective action: wdc-home2:~ wdc$ sudo ln -s /usr/bin/gzip /opt/local/bin/gzip Output of successful install after giving a gzip for it to find: wdc-home2:~ wdc$ sudo cpan install App::cpanminus Reading '/Users/wdc/.cpan/Metadata' Database was generated on Sun, 16 Dec 2018 10:17:03 GMT Running install for module 'App::cpanminus' Running make for M/MI/MIYAGAWA/App-cpanminus-1.7044.tar.gz Checksum for /Users/wdc/.cpan/sources/authors/id/M/MI/MIYAGAWA/App-cpanminus-1.7044.tar.gz ok CPAN.pm: Building M/MI/MIYAGAWA/App-cpanminus-1.7044.tar.gz Checking if your kit is complete... Looks good Generating a Unix-style Makefile Writing Makefile for App::cpanminus Writing MYMETA.yml and MYMETA.json cp lib/App/cpanminus/fatscript.pm blib/lib/App/cpanminus/fatscript.pm cp lib/App/cpanminus.pm blib/lib/App/cpanminus.pm cp bin/cpanm blib/script/cpanm "/usr/bin/perl" -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/cpanm Manifying 1 pod document Manifying 2 pod documents MIYAGAWA/App-cpanminus-1.7044.tar.gz /usr/bin/make -- OK 'YAML' not installed, will not store persistent state Running make test PERL_DL_NONLAZY=1 "/usr/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/happy_cpantesters.t .. 1/1 # App::cpanminus/1.7044 t/happy_cpantesters.t .. ok All tests successful. Files=1, Tests=1, 0 wallclock secs ( 0.03 usr 0.01 sys + 0.03 cusr 0.01 csys = 0.08 CPU) Result: PASS MIYAGAWA/App-cpanminus-1.7044.tar.gz /usr/bin/make test -- OK Running make install Manifying 1 pod document Manifying 2 pod documents Installing /Library/Perl/5.18/App/cpanminus.pm Installing /Library/Perl/5.18/App/cpanminus/fatscript.pm Installing /usr/local/share/man/man1/cpanm.1 Installing /usr/local/share/man/man3/App::cpanminus.3pm Installing /usr/local/share/man/man3/App::cpanminus::fatscript.3pm Installing /usr/local/bin/cpanm Appending installation info to /Library/Perl/Updates/5.18.2/darwin-thread-multi-2level/perllocal.pod MIYAGAWA/App-cpanminus-1.7044.tar.gz /usr/bin/make install -- OK wdc-home2:~ wdc$ which cpanm /usr/local/bin/cpanm Proof of success: wdc-home2:trunk wdc$ sudo cpanm --installdeps . --> Working on . Configuring /Users/wdc/src/pidp8i/trunk ... OK ==> Found dependencies: inc::Module::Install, Parallel::Loops, Math::Subsets::List --> Working on inc::Module::Install ... wdc-home2:~ wdc$ perl -V Summary of my perl5 (revision 5 version 18 subversion 2) configuration: Platform: osname=darwin, osvers=17.0, archname=darwin-thread-multi-2level uname='darwin osx357.sd.apple.com 17.0 darwin kernel version 16.1.0: mon oct 9 13:05:29 pdt 2017; root:xnu-3789.21.4.1.7~1development_x86_64 x86_64 ' config_args='-ds -e -Dprefix=/usr -Dccflags=-g -pipe -Dldflags= -Dman3ext=3pm -Duseithreads -Duseshrplib -Dinc_version_list=none -Dcc=cc' hint=recommended, useposix=true, d_sigaction=define useithreads=define, usemultiplicity=define useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef use64bitint=define, use64bitall=define, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-arch x86_64 -arch i386 -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -fstack-protector', optimize='-Os', cppflags='-g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -fstack-protector' ccversion='', gccversion='4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)', gccosandvers='' intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='cc', ldflags ='-arch x86_64 -arch i386 -fstack-protector' libpth=/usr/lib /usr/local/lib libs= perllibs= libc=, so=dylib, useshrplib=true, libperl=libperl.dylib gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-arch x86_64 -arch i386 -bundle -undefined dynamic_lookup -fstack-protector' Characteristics of this binary (from libperl): Compile-time options: HAS_TIMES MULTIPLICITY PERLIO_LAYERS PERL_DONT_CREATE_GVSV PERL_HASH_FUNC_ONE_AT_A_TIME_HARD PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP PERL_PRESERVE_IVUV PERL_SAWAMPERSAND USE_64_BIT_ALL USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF USE_REENTRANT_API Locally applied patches: /Library/Perl/Updates/<version> comes before system perl directories installprivlib and installarchlib points to the Updates directory Built under darwin Compiled at Apr 30 2018 20:18:52 %ENV: PERL_MB_OPT="--install_base "/Users/wdc/perl5"" PERL_MM_OPT="INSTALL_BASE=/Users/wdc/perl5" @INC: /Library/Perl/5.18/darwin-thread-multi-2level /Library/Perl/5.18 /Network/Library/Perl/5.18/darwin-thread-multi-2level /Network/Library/Perl/5.18 /Library/Perl/Updates/5.18.2/darwin-thread-multi-2level /Library/Perl/Updates/5.18.2 /System/Library/Perl/5.18/darwin-thread-multi-2level /System/Library/Perl/5.18 /System/Library/Perl/Extras/5.18/darwin-thread-multi-2level /System/Library/Perl/Extras/5.18 . --- cpan -D option: wdc-home2:~ wdc$ cpan -D cpanm Reading '/Users/wdc/.cpan/Metadata' Database was generated on Sun, 16 Dec 2018 10:17:03 GMT Warning: You are not allowed to write into directory "/Users/wdc/.cpan/sources/authors". I'll continue, but if you encounter problems, they may be due to insufficient permissions. Fetching with LWP: http://cpan.erlbaum.net/authors/01mailrc.txt.gz LWP failed with code[500] message[Can't connect to cpan.erlbaum.net:80 (Operation timed out)] Trying with /usr/local/bin/wget -O "/Users/wdc/.cpan/sources/authors/01mailrc.txt.gz.tmp55832" to get http://cpan.erlbaum.net/authors/01mailrc.txt.gz sh: /usr/local/bin/wget: Bad CPU type in executable Function system("/usr/local/bin/wget -O "/Users/wdc/.cpan/sources/authors/01mailrc.txt.gz.tmp55832" "http://cpan.erlbaum.net/authors/01mailrc.txt.gz" ") returned status 126 (wstat 32256) Warning: expected file [/Users/wdc/.cpan/sources/authors/01mailrc.txt.gz.tmp55832] doesn't exist Warning: no success downloading '/Users/wdc/.cpan/sources/authors/01mailrc.txt.gz.tmp55832'. Giving up on it. Fetching with LWP: http://httpupdate40.cpanel.net/CPAN/authors/01mailrc.txt.gz LWP failed with code[500] message[Can't connect to httpupdate40.cpanel.net:80 (Bad hostname)] Trying with /usr/local/bin/wget -O "/Users/wdc/.cpan/sources/authors/01mailrc.txt.gz.tmp55832" to get http://httpupdate40.cpanel.net/CPAN/authors/01mailrc.txt.gz sh: /usr/local/bin/wget: Bad CPU type in executable Function system("/usr/local/bin/wget -O "/Users/wdc/.cpan/sources/authors/01mailrc.txt.gz.tmp55832" "http://httpupdate40.cpanel.net/CPAN/authors/01mailrc.txt.gz" ") returned status 126 (wstat 32256) Warning: expected file [/Users/wdc/.cpan/sources/authors/01mailrc.txt.gz.tmp55832] doesn't exist Warning: no success downloading '/Users/wdc/.cpan/sources/authors/01mailrc.txt.gz.tmp55832'. Giving up on it. Fetching with LWP: http://cpan.mirror.clemson.edu/authors/01mailrc.txt.gz Can't write to '/Users/wdc/.cpan/sources/authors/01mailrc.txt.gz.tmp55832-55832': Permission denied at /System/Library/Perl/Extras/5.18/LWP/Protocol.pm line 105. at /System/Library/Perl/Extras/5.18/LWP/UserAgent.pm line 915.
On 2018-12-19 15:03:32, bill.cattey@gmail.com wrote: Show quoted text
> In using cpan to perform an install of the cpanm module > It worked fine under Mac OS 10.11, but after updating to 10.13, the > cpanm install seemed to succeed, but actually failed, and root cause > was that it was failing to find /opt/local/bin/gzip.
What is the value of your $PATH? If /opt/local/bin is in $PATH, everything should work properly. CPAN.pm should not look in that directory normally; this directory is added to $PATH via macports (/opt/local is the directory that macports uses for its installations). Likewise other package installers have their own custom directories for their installations and will update $PATH to include them.
Or maybe your config needs to be adjusted? If the cpan shell once was configured that path to gzip is /opt/local/bin/gzip, it will continue to look there. Maybe try 'o conf init gzip' in the cpan shell or edit the config file directly. I have no OSX box myself, so I need your help to identify what the problem is. Thanks to Karen for stepping in.
On Wed Dec 19 20:49:52 2018, ETHER wrote: Show quoted text
> On 2018-12-19 15:03:32, bill.cattey@gmail.com wrote:
> > In using cpan to perform an install of the cpanm module > > It worked fine under Mac OS 10.11, but after updating to 10.13, the > > cpanm install seemed to succeed, but actually failed, and root cause > > was that it was failing to find /opt/local/bin/gzip.
> > What is the value of your $PATH? If /opt/local/bin is in $PATH, > everything > should work properly. > > CPAN.pm should not look in that directory normally; this directory is > added to > $PATH via macports (/opt/local is the directory that macports uses for > its > installations). Likewise other package installers have their own > custom > directories for their installations and will update $PATH to include > them.
/opt/local/bin is in my path: wdc-home2:~ wdc$ echo $PATH /opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/local/git/bin:/usr/local/bin:/opt/local/bin:/opt/local/sbin:/opt/local/libexec/qt4/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin But the problem was that, cpan was looking ONLY in /opt/local/bin for gzip. On Mac OS 10.13, gzip is in /usr/bin (which is also in my PATH.) So cpan was using some funky path, not related to my shell path.
On Wed Dec 19 22:42:50 2018, ANDK wrote: Show quoted text
> Or maybe your config needs to be adjusted? If the cpan shell once was > configured that path to gzip is /opt/local/bin/gzip, it will continue > to look there. Maybe try 'o conf init gzip' in the cpan shell or edit > the config file directly. > > I have no OSX box myself, so I need your help to identify what the > problem is. Thanks to Karen for stepping in.
It is possible that cpan had a stale configuration from the old Mac OS install. Here is what I get when I run the cpan shell, and try "o conf init gzip" as you suggest. I find it odd that it complained about not being able to write /Users/wdc/.cpan/CPAN/MyConfig.pm the first time, but was able to do so when I did "su cpan". However I see that root owns my .cpan directory. I have no idea how that could have happened. wdc-home2:trunk wdc$ ls -ld ~/.cpan drwxr-xr-x 8 root staff 256 Dec 19 23:16 /Users/wdc/.cpan There's a TON of stuff in there owned by root. Why is cpan creating a system-level hierarchy of installation under a user home directory??? I also don't understand what the complaints are about unknown config variables. I can look for a global config file, if you have suggestions about where to look. Here is the output: wdc-home2:~ wdc$ cpan Terminal does not support AddHistory. Your configuration suggests that CPAN.pm should use a working directory of /Users/wdc/.cpan Unfortunately we could not create the lock file /Users/wdc/.cpan/.lock due to 'Permission denied'. Please make sure that the configuration variable $CPAN::Config->{cpan_home} points to a directory where you can write a .lock file. You can set this variable in either a CPAN/MyConfig.pm or a CPAN/Config.pm in your @INC path; cpan shell -- CPAN exploration and modules installation (v2.00) Enter 'h' for help. nolock_cpan[1]> o conf init gzip <gzip> Where is your gzip program? [/opt/local/bin/gzip] /usr/bin/gzip Please remember to call 'o conf commit' to make the config permanent! nolock_cpan[2]> o conf commit WARNING: CPAN.pm is unable to write a configuration file. You must be able to create and write to '/Users/wdc/.cpan/CPAN/MyConfig.pm'. Aborting configuration. nolock_cpan[3]> quit wdc-home2:~ wdc$ sudo cpan Terminal does not support AddHistory. cpan shell -- CPAN exploration and modules installation (v2.00) Enter 'h' for help. cpan[1]> o conf init gzip <gzip> Where is your gzip program? [/opt/local/bin/gzip] /usr/bin/gzip Please remember to call 'o conf commit' to make the config permanent! cpan[2]> o conf commit Unknown config variable 'recommends_policy' Unknown config variable 'suggests_policy' Unknown config variable 'use_prompt_default' commit: wrote '/Users/wdc/.cpan/CPAN/MyConfig.pm' cpan[3]> quit Terminal does not support GetHistory. Lockfile removed. wdc-home2:~ wdc$
Subject: Re: [rt.cpan.org #128063] MacOS 10.13 looks for gzip in /opt/local/bin not /usr/bin
Date: Thu, 20 Dec 2018 22:21:58 +0100
To: "Bill Cattey via RT" <bug-CPAN [...] rt.cpan.org>
From: Andreas Koenig <andreas.koenig.7os6VVqR [...] franz.ak.mind.de>
Show quoted text
>>>>> On Wed, 19 Dec 2018 23:22:18 -0500, "Bill Cattey via RT" <bug-CPAN@rt.cpan.org> said:
Show quoted text
> Queue: CPAN > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=128063 >
Show quoted text
> On Wed Dec 19 22:42:50 2018, ANDK wrote:
>> Or maybe your config needs to be adjusted? If the cpan shell once was >> configured that path to gzip is /opt/local/bin/gzip, it will continue >> to look there. Maybe try 'o conf init gzip' in the cpan shell or edit >> the config file directly. >> >> I have no OSX box myself, so I need your help to identify what the >> problem is. Thanks to Karen for stepping in.
Show quoted text
> It is possible that cpan had a stale configuration from the old Mac OS install.
That's what I guessed, glad you confirm it. Show quoted text
> Here is what I get when I run the cpan shell, and try "o conf init gzip" as you suggest. > I find it odd that it complained about not being able to write > /Users/wdc/.cpan/CPAN/MyConfig.pm the first time, but was able to do so > when I did "su cpan".
I think it's crucial that you make up your own rules under which circumstances you use sudo. The cpan shell is not going to tell you. Show quoted text
> However I see that root owns my .cpan directory. I have no idea how > that could have happened.
Better you watch who accesses your keyboard! Show quoted text
> wdc-home2:trunk wdc$ ls -ld ~/.cpan > drwxr-xr-x 8 root staff 256 Dec 19 23:16 /Users/wdc/.cpan
Show quoted text
> There's a TON of stuff in there owned by root. Why is cpan creating a system-level > hierarchy of installation under a user home directory???
There seem to be (at least) two questions asked at once. One is that the tool cpan requires space to to its duty. When you go through the configuration procedure step by step you can configure many aspects of where and how it has to do it. The second question is about the permissions of these files. Seriously, the permissions depend on how you were using the cpan shell. When you switched between your user identity and sudo to root a lot, then it of course happened that files were created sometimes as you and sometimes as root. That's something you need to understand properly. And when a directory belongs to root and later you act as yourself, it of course can easily happen that you have no permissions to use your system. Show quoted text
> I also don't understand what the complaints are about unknown config > variables.
I also don't know. Looks like at some point you upgraded cpan and later downgraded it again. But I'm not sure. But this is certainly something you can ignore for now. Better you concentrate on permissions first. Show quoted text
> I can look for a global config file, if you have suggestions about > where to look.
It is /Users/wdc/.cpan/CPAN/MyConfig.pm, you mentioned it yourself several time. -- andreas
On Thu Dec 20 16:22:11 2018, andreas.koenig.7os6VVqR@franz.ak.mind.de wrote: Show quoted text
> >>>>> On Wed, 19 Dec 2018 23:22:18 -0500, "Bill Cattey via RT" <bug- > >>>>> CPAN@rt.cpan.org> said:
>
> > Queue: CPAN > > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=128063 >
>
> > On Wed Dec 19 22:42:50 2018, ANDK wrote:
> >> Or maybe your config needs to be adjusted? If the cpan shell once > >> was > >> configured that path to gzip is /opt/local/bin/gzip, it will > >> continue > >> to look there. Maybe try 'o conf init gzip' in the cpan shell or > >> edit > >> the config file directly. > >> > >> I have no OSX box myself, so I need your help to identify what the > >> problem is. Thanks to Karen for stepping in.
>
> > It is possible that cpan had a stale configuration from the old Mac > > OS install.
> > That's what I guessed, glad you confirm it. >
> > Here is what I get when I run the cpan shell, and try "o conf init > > gzip" as you suggest. > > I find it odd that it complained about not being able to write > > /Users/wdc/.cpan/CPAN/MyConfig.pm the first time, but was able to do > > so > > when I did "su cpan".
> > I think it's crucial that you make up your own rules under which > circumstances > you use sudo. The cpan shell is not going to tell you. >
> > However I see that root owns my .cpan directory. I have no idea how > > that could have happened.
> > Better you watch who accesses your keyboard! >
> > wdc-home2:trunk wdc$ ls -ld ~/.cpan > > drwxr-xr-x 8 root staff 256 Dec 19 23:16 /Users/wdc/.cpan
>
> > There's a TON of stuff in there owned by root. Why is cpan creating > > a system-level > > hierarchy of installation under a user home directory???
> > There seem to be (at least) two questions asked at once. One is that > the > tool cpan requires space to to its duty. When you go through the > configuration procedure step by step you can configure many aspects of > where and how it has to do it. > > The second question is about the permissions of these files. > Seriously, > the permissions depend on how you were using the cpan shell. When you > switched between your user identity and sudo to root a lot, then it of > course happened that files were created sometimes as you and sometimes > as root. That's something you need to understand properly. And when a > directory belongs to root and later you act as yourself, it of course > can easily happen that you have no permissions to use your system. >
> > I also don't understand what the complaints are about unknown config > > variables.
> > I also don't know. Looks like at some point you upgraded cpan and > later > downgraded it again. But I'm not sure. But this is certainly something > you can ignore for now. Better you concentrate on permissions first. >
> > I can look for a global config file, if you have suggestions about > > where to look.
> > It is /Users/wdc/.cpan/CPAN/MyConfig.pm, you mentioned it yourself > several time.
Thank you, Andreas, for taking the time to answer my question point by point. I think I had an over-arching question that I asked poorly. Before I ask the question, I would like to air a misunderstanding I have about how cpan does its work. I will also note in passing that I have two parallel perl systems installed, and maybe that's ok, but I'm hoping that, as I understand better, I'll be able to better control whether or not the second one is actually kept and/or used. So I have two perl systems installed, the one that came with Mac OS. The main perl executable lives in /usr/bin/perl. (version 5.18) The other lives in /opt/local. (version 5.26) It got installed when, after my 10.13 upgrade, I tried to use macports to install cpanminus. I did "sudo port install p5-app-cpanminus". Oddly, that install didn't create a link from /opt/local/bin/perl to /opt/local/bin/perl5.26. Indeed I have /opt/local/bin/cpan-5.26 and /opt/local/bin/cpanm-5.26, but no perl, cpan, or cpanm in /opt/localbin. (I shall have to take this up with the macports folk to understand why that is so, since I did the macports install first, and expected it to shadow my system perl with a newer version and just work. My expectation was that I needed to run cpan as root, because I expected it would be performing installs into system directories, (as Macports did when it installed stuff in /opt/local.) (We're getting to my question. Thanks for your patience this far.) QUESTION: Is cpan intended for use by people who do not have access to system directories so that they can install Perl modules for themselves without bothering system administrators? I.E. Is it a mistake ever to run cpan as root? I think this means that my bug report should be closed as "Not a Bug", but also brings up a couple questions: 1. What document should I have read to have understood how to use cpan correctly? 2. Given that I have a cpan install in two places with inconsistent and broken legacy configurations, how do I clean this up? I apologize in advance for needing support instead of a bug fix.
Subject: Re: [rt.cpan.org #128063] MacOS 10.13 looks for gzip in /opt/local/bin not /usr/bin
Date: Fri, 21 Dec 2018 06:02:27 +0100
To: "Bill Cattey via RT" <bug-CPAN [...] rt.cpan.org>
From: Andreas Koenig <andreas.koenig.7os6VVqR [...] franz.ak.mind.de>
Show quoted text
>>>>> On Thu, 20 Dec 2018 18:04:55 -0500, "Bill Cattey via RT" <bug-CPAN@rt.cpan.org> said:
Show quoted text
> Thank you, Andreas, for taking the time to answer my question point by point.
You're welcome! Show quoted text
> I think I had an over-arching question that I asked poorly. Before I ask the question, > I would like to air a misunderstanding I have about how cpan does its work.
Show quoted text
> I will also note in passing that I have two parallel perl systems installed, and maybe that's ok, > but I'm hoping that, as I understand better, I'll be able to better control whether or not the second one > is actually kept and/or used.
Show quoted text
> So I have two perl systems installed, the one that came with Mac OS. The main perl executable > lives in /usr/bin/perl. (version 5.18)
Show quoted text
> The other lives in /opt/local. (version 5.26) It got installed when, after my 10.13 upgrade, I tried to use > macports to install cpanminus. I did "sudo port install p5-app-cpanminus". Oddly, that install didn't > create a link from /opt/local/bin/perl to /opt/local/bin/perl5.26.
Show quoted text
> Indeed I have /opt/local/bin/cpan-5.26 and /opt/local/bin/cpanm-5.26, but no perl, cpan, or cpanm > in /opt/localbin. (I shall have to take this up with the macports folk to understand why that is so, > since I did the macports install first, and expected it to shadow my system perl with a newer > version and just work.
Show quoted text
> My expectation was that I needed to run cpan as root, because I expected it would be > performing installs into system directories, (as Macports did when it installed stuff in > /opt/local.)
Show quoted text
> (We're getting to my question. Thanks for your patience this far.)
Show quoted text
> QUESTION:
Show quoted text
> Is cpan intended for use by people who do not have access to system directories so that > they can install Perl modules for themselves without bothering > system administrators?
For every single thing it works on it has two types of phases, one for downloading, building and testing stuff and one to install. Only the installation phase is a candidate that may require root permissions. Since perl knowns where to install, cpan and cpanm let other perl and system tools do the installation. When root permissions are required for the installation step, you can configure how to switch user which you normally do with sudo. If root permissions are not required, you can configure to not use sudo. Show quoted text
> I.E. Is it a mistake ever to run cpan as root?
Given that it downloads and installs software from the internet for you, it is inherently dangerous and should not be run as root. Same for cpanm. Show quoted text
> I think this means that my bug report should be closed as "Not a Bug", but also brings up > a couple questions:
Show quoted text
> 1. What document should I have read to have understood how to use > cpan correctly?
I think the CPAN.pm manpage has everything you need. Then start learning about other tools like probably local::lib. Your complications seem to have their root in having to deal with two perls which may need some extra knowledge about those. Show quoted text
> 2. Given that I have a cpan install in two places with inconsistent > and broken legacy configurations, how do I clean this up?
chown -R you:you ~/.cpan might be good enough. Whenever you have doubts that the system operates the way you expect it to run, take a step back and find out what's wrong. Backup your system and fix the problem before you continue using the cpan shell. Reconfiguring your cpan installation is done with o conf init from the cpan shell. Show quoted text
> I apologize in advance for needing support instead of a bug fix.
np:) -- andreas
I am another MacPorts user, and have encountered a similar issue. I want to try clarifying some things here.
 
If I understand correctly, CPAN.pm requires gzip. If that is correct, then I think there are actually two issues noticed here: one being that CPAN shell will continue with installing a module even if the gzip is missing (i.e. it should instead fail early and not continue), and the other being that MacPorts installs CPAN.pm configured to use gzip from MacPorts, but does not ensure that it installs gzip. For this second issue I have opened a ticket: https://trac.macports.org/ticket/58610
 
Some more notes on MacPorts:
 
MacPorts has a policy to minimize dependency on software outside of its control, so it may be intentional that it configures CPAN.pm to **only** use /opt/local/bin/gzip, and avoid using gzip from /usr/bin or from the PATH; if this is the case, then MacPorts needs to adjust the perl5.xx port to also install gzip. However if this policy does not apply to gzip, then CPAN.pm presumably needs to be configured with the system gzip (and probably still not from PATH to reduce potential issues or confusion).
 
The perl5 port is what to install in order to have unversioned aliases for perl, cpan, and quite few other commands. Installing p5-app-cpanminus does not automatically install the perl5 port (p5-app-cpanminus installs p5.xx-app-cpanminus, which installs perl5.xx; perl5 installs perl5.xx, but perl5.xx does not install perl5). However, there does not appear to be a way to automatically have an unversioned alias for cpanm (I suggest filing a bug/feature request if that's desirable).
 
One main argument for MacPorts only providing versioned commands by default is to allow specifying different Perl versions among multiple ones provided by MacPorts, or alongside installations outside MacPorts (e.g. the system Perl bundled with macOS).
 
If there is a port p5-foo-bar for a module Foo::Bar, it is probably recommended to try installing it through MacPorts before trying through cpan/cpanm.