On Fri, Jan 22, 2021, at 7:35 PM, Achim Gratz wrote:
> 
> For good measure I repeated this with /usr/local not existing at all and
> the result stays the same.

Achim,  that was a helpful test, thankyou.   Digging further, the triggering 
perl code in /usr/share/perl5/5.30/CPAN/FirstTime.pm,  so to replicate I also 
need to delete my ~/.cpan directory.   Could you try doing that too and see if 
you agree?

Here's the fuller problem, which is more than a cosmetic warning:

================

% cpan install Win32::Symlink
Loading internal logger. Log::Log4perl recommended for better logging

CPAN.pm requires configuration, but most of it can be done automatically.
If you answer 'no' below, you will enter an interactive dialog for each
configuration option instead.

Would you like to configure as much as possible automatically? [yes]
Use of uninitialized value $what in concatenation (.) or string at 
/usr/share/perl5/5.30/App/Cpan.pm line 679, <STDIN> line 1.

Warning: You do not have write permission for Perl library directories.

To install modules, you need to configure a local Perl library directory or
escalate your privileges.  CPAN can help you by bootstrapping the local::lib
module or by configuring itself to use 'sudo' (if available).  You may also
resolve this problem manually if you need to customize your setup.

What approach do you want?  (Choose 'local::lib', 'sudo' or 'manual')
 [local::lib]
[...]

================

So the _apparent_ lack of write permission triggers a whole load of privilege 
escalation machinery which is unnecessary.

This code is in 

    unless ( $matcher
        || _can_write_to_libdirs() || _using_installbase() || _using_sudo()
    ) {
        local $auto_config = 0; # We *must* ask, even under autoconfig
        local *_real_prompt;    # We *must* show prompt
        my_prompt_loop(install_help => 'local::lib', $matcher,
                   'local::lib|sudo|manual');
    }

and the core test on that looks like this:

sub _can_write_to_libdirs {
    return -w $Config{installprivlib}
        && -w $Config{installarchlib}
        && -w $Config{installsitelib}
        && -w $Config{installsitearch}
}

hence there is an assumption that these directories exist.

--
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

Reply via email to