Skip Menu |

This queue is for tickets about the ExtUtils-Command CPAN distribution.

Report information
The Basics
Id: 49815
Status: open
Priority: 0/
Queue: ExtUtils-Command

People
Owner: Nobody in particular
Requestors: SteveHay [...] planit.com
Cc: nick [...] ccl4.org
steve.m.hay [...] googlemail.com
AdminCc:

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



CC: nick [...] ccl4.org,steve.m.hay [...] googlemail.com
Subject: ExtUtils-Command cp returns success when the source is missing (on Win32)
The command perl -MExtUtils::Command -e cp foo bar produces no errors or warnings, and the exit status in the shell is 0 (success), when 'foo' doesn't exist. Tested with bleadperl on Windows XP. This caused considerable confusion during the recent changes to the DynaLoader build process, in which a similar command to copy a missing DynaLoader.obj file failed to alert us to the non-existence of the file.
Subject: Re: [rt.cpan.org #49815] ExtUtils-Command cp returns success when the source is missing (on Win32)
Date: Fri, 18 Sep 2009 16:13:39 -0700
To: bug-ExtUtils-Command [...] rt.cpan.org
From: Michael G Schwern <schwern [...] pobox.com>
Steve Hay via RT wrote: Show quoted text
> The command > > perl -MExtUtils::Command -e cp foo bar > > produces no errors or warnings, and the exit status in the shell is 0 > (success), when 'foo' doesn't exist. Tested with bleadperl on Windows XP. > > This caused considerable confusion during the recent changes to the > DynaLoader build process, in which a similar command to copy a missing > DynaLoader.obj file failed to alert us to the non-existence of the file.
ExtUtils::Command isn't terribly consistent about how it handles errors. It should probably warn and exit with 1 consistently like a shell command would. mv, cp, eqtime, rm_rf, rm_f, touch... pretty much everything except the test* functions have this problem. -- You are wicked and wrong to have broken inside and peeked at the implementation and then relied upon it. -- tchrist in <31832.969261130@chthon>
On Fri Sep 18 19:14:07 2009, schwern@pobox.com wrote: Show quoted text
> Steve Hay via RT wrote:
> > The command > > > > perl -MExtUtils::Command -e cp foo bar > > > > produces no errors or warnings, and the exit status in the shell is
> 0
> > (success), when 'foo' doesn't exist. Tested with bleadperl on
> Windows XP.
> > > > This caused considerable confusion during the recent changes to the > > DynaLoader build process, in which a similar command to copy a
> missing
> > DynaLoader.obj file failed to alert us to the non-existence of the
> file. > > ExtUtils::Command isn't terribly consistent about how it handles > errors. It > should probably warn and exit with 1 consistently like a shell command > would. > > mv, cp, eqtime, rm_rf, rm_f, touch... pretty much everything except > the test* > functions have this problem. > >
Would there be any issue with backwards compatibility to change the behaviour of the affected functions from returning values to if ($some_error_condition) { warn "Something wrong happened: $!"; exit(1); } else { exit(0); }
Subject: Re: [rt.cpan.org #49815] ExtUtils-Command cp returns success when the source is missing (on Win32)
Date: Sun, 20 Sep 2009 10:18:23 -0700
To: bug-ExtUtils-Command [...] rt.cpan.org
From: Michael G Schwern <schwern [...] pobox.com>
RKOBES via RT wrote: Show quoted text
> Would there be any issue with backwards compatibility to change the > behaviour of the affected functions from returning values to > if ($some_error_condition) { > warn "Something wrong happened: $!"; > exit(1); > } > else { > exit(0); > }
Yes, its a definite change and I'm sure its going to break something but nothing likely to be important. I'd say go for it, its definitely the right thing to do. Just make sure Shell::Command still works. This might be a good opportunity to rejigger things so that the bulk of the code goes into Shell::Command and acts like normal functions taking normal arguments with normal return values and throwing exceptions on failure. Then ExtUtils::Command becomes a wrapper that: my $wrapper = sub { eval { $real_function->(@ARGV) } or do { warn $@; exit 1; }; exit 0; };
RT-Send-CC: srezic [...] iconmobile.com
On 2009-09-20 13:18:48, schwern@pobox.com wrote: Show quoted text
> RKOBES via RT wrote:
> > Would there be any issue with backwards compatibility to change the > > behaviour of the affected functions from returning values to > > if ($some_error_condition) { > > warn "Something wrong happened: $!"; > > exit(1); > > } > > else { > > exit(0); > > }
> > Yes, its a definite change and I'm sure its going to break something > but > nothing likely to be important. I'd say go for it, its definitely the > right > thing to do. Just make sure Shell::Command still works. >
From me another vote to change the behavior at least for cp and mv, even if it means breaking backward-compatibility. At least it looks like EUMM does not use ExtUtils::Command::{cp,mv} by default, so normal EUMM-generated Makefiles are not effected. Regards, Slaven
Subject: Re: [rt.cpan.org #49815] ExtUtils-Command cp returns success when the source is missing (on Win32)
Date: Fri, 11 Jun 2010 12:34:53 -0700
To: bug-ExtUtils-Command [...] rt.cpan.org
From: Michael G Schwern <schwern [...] pobox.com>
On 2010.6.11 2:15 AM, Slaven_Rezic via RT wrote: Show quoted text
>From me another vote to change the behavior at least for cp and mv, even > if it means breaking backward-compatibility. At least it looks like EUMM > does not use ExtUtils::Command::{cp,mv} by default, so normal > EUMM-generated Makefiles are not effected.
EUMM uses them by default. It overrides them for Unix. So its used by Windows and VMS. -- Reality is that which, when you stop believing in it, doesn't go away. -- Phillip K. Dick