Skip Menu |
 

This queue is for tickets about the Module-Build CPAN distribution.

Report information
The Basics
Id: 43863
Status: resolved
Priority: 0/
Queue: Module-Build

People
Owner: Nobody in particular
Requestors: RIVY [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.31012
Fixed in: (no value)



Subject: ACTION_realclean occasionally fails to delete Build.BAT (case comparison bug)
Download (untitled) / with headers
text/plain 905b
ACTION_realclean() will fail to delete the Build.bat file if the batch is executed with differing case (i.e., if the the build file is 'Build.PL' then the batch file will be named 'Build.bat' and both 'BUILD realclean' or 'build realclean' will fail to delete the batch file). I've attached a modified ACTION_realclean() which fixes the case comparison bug. I've also made two minor "improvements", adding '/d' to the $cmd argument to avoid executing AutoRUN batch files and surrounding the $cmd entry added to the batch file with newlines to avoid generating a bugged command line if the batch file is further modified/appended. NOTE: the attached ACTION_realclean() function is designed to be used in a custom Build.PL to circumvent the problem. The line '$self->SUPER::ACTION_realclean()' at the beginning of the function would obviously be removed if incorporated into the Module::Build code. - Roy
Subject: ACTION_realclean.txt
sub ACTION_realclean { ## BUG in Module::Build v0.30 : Win32 is case-insensitive => so comparisons should be case insensitive => '$basename eq $self->build_script' should be 'lc($basename) eq lc($self->build_script)' ## and 'Vodoo' is misspelled my ($self) = @_; $self->SUPER::ACTION_realclean(); my $basename = basename($0); $basename =~ s/(?:\.bat)?$//i; if ( ($basename eq $self->build_script) || (File::Spec->case_tolerant() && (lc($basename) eq lc($self->build_script))) ) { if ( $self->build_bat ) { my $full_progname = $0; $full_progname =~ s/(?:\.bat)?$/.bat/i; $full_progname = File::Spec::Functions::rel2abs($full_progname); # Voodoo required to have a batch file delete itself without error; # Syntax differs between 9x & NT: the later requires a null arg (???) ## TODO: discuss race condition that occurs here: if other process completes 1st (which should almost never occur) the deletion will still be successful just a possible error message might occur = "The batch file cannot be found." & user may notice that the .bat file is still existant for a couple of seconds until the other process starts/inits/completes the deletion ## use /d to avoid AutoRUN as well (we only need a basic shell, no addons) require Win32; my $null_arg = (Win32::IsWinNT()) ? q{""} : q{}; my $cmd = qq(start $null_arg /min "%comspec%" /d /c del "$full_progname"); my $fh = IO::File->new(">> $basename.bat") or die "Can't create $basename.bat: $!"; print $fh qq{\n}.$cmd.qq{\n}; ## TODO: calling SUPER::ACTION_realclean() caused a bug repeating the command twice on the same line causing it to fail for PowerShell => add a new line first close $fh ; } else { $self->delete_filetree($self->build_script . '.bat'); } } }
Confirmed bug still exists on M::B 0.33.
Fixed in repository trunk


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.