public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Perl's ExtUtils::MakeMaker fails and proposed fix
@ 2011-07-07 18:46 Marco Moreno
  2011-07-11  5:56 ` Reini Urban
  0 siblings, 1 reply; 5+ messages in thread
From: Marco Moreno @ 2011-07-07 18:46 UTC (permalink / raw)
  To: cygwin

Reini,

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);
}


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?

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Perl's ExtUtils::MakeMaker fails and proposed fix
  2011-07-07 18:46 Perl's ExtUtils::MakeMaker fails and proposed fix Marco Moreno
@ 2011-07-11  5:56 ` Reini Urban
  2011-07-11 13:01   ` Reini Urban
  0 siblings, 1 reply; 5+ messages in thread
From: Reini Urban @ 2011-07-11  5:56 UTC (permalink / raw)
  To: cygwin

2011/7/7 Marco Moreno:
> Reini,
>
> 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);
> }
>
>
> 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.
-- 
Reini

--
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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Perl's ExtUtils::MakeMaker fails and proposed fix
  2011-07-11  5:56 ` Reini Urban
@ 2011-07-11 13:01   ` Reini Urban
  2011-07-12 18:37     ` Marco Moreno
  2012-04-06 20:17     ` Marco Moreno
  0 siblings, 2 replies; 5+ messages in thread
From: Reini Urban @ 2011-07-11 13:01 UTC (permalink / raw)
  To: cygwin

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

--
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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Perl's ExtUtils::MakeMaker fails and proposed fix
  2011-07-11 13:01   ` Reini Urban
@ 2011-07-12 18:37     ` Marco Moreno
  2012-04-06 20:17     ` Marco Moreno
  1 sibling, 0 replies; 5+ messages in thread
From: Marco Moreno @ 2011-07-12 18:37 UTC (permalink / raw)
  To: cygwin


On Jul 11, 2011, at 9:00 AM, Reini Urban wrote:

> 2011/7/11 Reini Urban:
>> 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

Thanks for taking the initiative to submit this patch and saving me
the trouble of figuring out how.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Perl's ExtUtils::MakeMaker fails and proposed fix
  2011-07-11 13:01   ` Reini Urban
  2011-07-12 18:37     ` Marco Moreno
@ 2012-04-06 20:17     ` Marco Moreno
  1 sibling, 0 replies; 5+ messages in thread
From: Marco Moreno @ 2012-04-06 20:17 UTC (permalink / raw)
  To: cygwin

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-04-06 20:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-07 18:46 Perl's ExtUtils::MakeMaker fails and proposed fix Marco Moreno
2011-07-11  5:56 ` Reini Urban
2011-07-11 13:01   ` Reini Urban
2011-07-12 18:37     ` Marco Moreno
2012-04-06 20:17     ` Marco Moreno

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).