Subject: | Improper use of || in Release.pm |
This is for Cvs.pm-0.06
perl -v
This is perl, v5.8.1-RC3 built for darwin-thread-multi-2level
uname -a
Darwin William-Daffers-Computer.local 7.3.0 Darwin Kernel Version 7.3.0: Fri Mar 5 14:22:55 PST 2004; root:xnu/xnu-517.3.15.obj~4/RELEASE_PPC Power Macintosh powerpc
Line 30 of Release.pm
$self->push_arg(@modules || $self->cvs->workdir());
misuses the || by comparing an array with a scalar. If the user passes any `modules' to Release the attempt to add the modules to the `cvs release' command will fail because the line
@modules || $self->cvs->workdir()
returns the number of elements in @modules, NOT the @modules array itself.
I've included a patch that I think works.
*** /Library/Perl/5.8.1/Cvs/Command/Release.pm Tue Apr 6 09:07:49 2004
--- /Library/Perl/5.8.1/Cvs/Command/Release.pm.orig Tue Apr 6 09:05:52 2004
***************
*** 27,37 ****
$self->command('release');
$self->push_arg('-d')
if $self->param->{delete_after};
! if (@modules) {
! $self->push_arg(@modules);
! } else {
! $self->push_arg($self->cvs->workdir());
! }
$self->go_into_workdir(0);
my $main = $self->new_context();
--- 27,33 ----
$self->command('release');
$self->push_arg('-d')
if $self->param->{delete_after};
! $self->push_arg(@modules || $self->cvs->workdir());
$self->go_into_workdir(0);
my $main = $self->new_context();