public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: "Anthony Heading" <anthony@ajrh.net>
To: "Marco Atzeri via Cygwin" <cygwin@cygwin.com>
Subject: Re: missing perl directories
Date: Fri, 22 Jan 2021 21:05:21 +0000	[thread overview]
Message-ID: <e8bc4b16-b459-4e89-b6b3-6b80e7f9a933@www.fastmail.com> (raw)
In-Reply-To: <87czxw3gu0.fsf@Rainer.invalid>

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.


  reply	other threads:[~2021-01-22 21:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-21 16:09 Anthony Heading
2021-01-21 16:22 ` Marco Atzeri
2021-01-22  7:33 ` Brian Inglis
2021-01-22 16:15   ` Anthony Heading
2021-01-22 16:36     ` Marco Atzeri
2021-01-22 17:53       ` Anthony Heading
2021-01-22 19:43         ` Ken Brown
2021-01-22 20:29         ` Achim Gratz
2021-01-22 19:35 ` Achim Gratz
2021-01-22 21:05   ` Anthony Heading [this message]
2021-01-23 19:08     ` Achim Gratz
2021-01-24 16:14       ` Anthony Heading

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e8bc4b16-b459-4e89-b6b3-6b80e7f9a933@www.fastmail.com \
    --to=anthony@ajrh.net \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).