delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/04/06/16:17:38

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-3.8 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <CAHiT=DEksPw16e9jdjuVAa=crCJqtN=3SOVxmAG0aoJGWh2xbA@mail.gmail.com>
References: <CAJfRpHqagKODKmWEuQ-NRJGz-XNCkLcFk_DWxxLh47nDK-iBkg AT mail DOT gmail DOT com> <CAHiT=DGz4Y2igAOgTxSNY0dKyYgbh3+-BjuKDTziH14rJYf_GQ AT mail DOT gmail DOT com> <CAHiT=DEksPw16e9jdjuVAa=crCJqtN=3SOVxmAG0aoJGWh2xbA AT mail DOT gmail DOT com>
Date: Fri, 6 Apr 2012 16:17:12 -0400
Message-ID: <CAJfRpHrOaG6QeJnvr1E8QjwGjshV5mX4MEdRHG4py97+z=UFgA@mail.gmail.com>
Subject: Re: Perl's ExtUtils::MakeMaker fails and proposed fix
From: Marco Moreno <mmoreno AT pobox DOT com>
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id q36KHYfZ031806

On Mon, Jul 11, 2011 at 9:00 AM, Reini Urban wrote:
>
> 2011/7/11 Reini Urban:
> > 2011/7/7 Marco Moreno:
> >> After doing a little debugging, I discovered why installing ExtUtils::MakeMaker
> >> was failing for me.  ExtUtils::MM_Cygwin.pm contains:
> >>
> >> =item maybe_command
> >>
> >> If our path begins with F</cygdrive/> then we use C<ExtUtils::MM_Win32>
> >> to determine if it may be a command.  Otherwise we use the tests
> >> from C<ExtUtils::MM_Unix>.
> >>
> >> =cut
> >>
> >> sub maybe_command {
> >>    my ($self, $file) = @_;
> >>
> >>    if ($file =~ m{^/cygdrive/}i) {
> >>        return ExtUtils::MM_Win32->maybe_command($file);
> >>    }
> >>
> >>    return $self->SUPER::maybe_command($file);
> >> }
> >>
> >>
> >> Obviously, if your cygdrive prefix is something else (e.g. '/'), then
> >> this will fail.
> >>
> >> What do you think of this instead:
> >>
> >> =item maybe_command
> >>
> >> Determine whether a file is native to Cygwin by checking whether it
> >> resides inside the Cygwin installation (using Windows paths).  If so,
> >> use C<ExtUtils::MM_Unix> to determine if it may be a command.
> >> Otherwise use the tests from C<ExtUtils::MM_Win32>.
> >>
> >> =cut
> >>
> >> sub maybe_command {
> >>    my ($self, $file) = @_;
> >>
> >>    my $cygwin_winpath = Cygwin::posix_to_win_path('/', 1);
> >>    my $file_winpath = Cygwin::posix_to_win_path($file, 1);
> >>
> >>    return ($file_winpath =~ /^${cygwin_winpath}/)
> >>        ? $self->SUPER::maybe_command($file)
> >>        : ExtUtils::MM_Win32->maybe_command($file);
> >> }
>
> I improved it a bit, because I don't like userdata end up in regexp.
>
>    my $cygpath = Cygwin::posix_to_win_path('/', 1);
>    my $filepath = Cygwin::posix_to_win_path($file, 1);
>
>    return (substr($filepath,0,length($cygpath)) eq $cygpath)
>        ? $self->SUPER::maybe_command($file)        # Unix
>        : ExtUtils::MM_Win32->maybe_command($file); # Win32
>
>
> >>
> >>
> >> This passed all the tests and installed ok for me.  Does this look
> >> ok to you and is it reasonable to assume that native Cygwin
> >> commands will always be inside the Cygwin installation directory?
> >> If this proposed change is worthy of implementing, what is the best
> >> way to do it?  rt.cpan.org?
> >
> > Sorry, I did not come to test this this weekend.
> >
> > Yes, this uncommon cornercase looks worthy to be fixed.
> > Please file a perlbug for this. It should go to rt.perl.org.
>
> I just added it as https://rt.perl.org/rt3/Ticket/Display.html?id=94532


Reini,

This bug from last year just bit me again today.  I checked the
perlbug you submitted and its status says it was rejected.  Do you
know why?  Should it be resubmitted?

Marco Moreno

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


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019