]> git.donarmstrong.com Git - perltidy.git/blob - debian/patches/die_on_unlink_failures
update the patch for 862667 to match upstream's version and disable
[perltidy.git] / debian / patches / die_on_unlink_failures
1 Description: die if perltidy.ERR and other temporary files cannot be unlinked
2 Origin: Upstream, Cherrypicked from 20170521.
3 Author: Don Armstrong <don@debian.org>, Steve Hancock
4 diff --git a/lib/Perl/Tidy.pm b/lib/Perl/Tidy.pm
5 index 2b0df0e..edcec6d 100644
6 --- a/lib/Perl/Tidy.pm
7 +++ b/lib/Perl/Tidy.pm
8 @@ -3692,7 +3702,10 @@ sub do_syntax_check {
9      # now wish for luck...
10      my $msg = qx/perl $flags $quoted_stream_filename $error_redirection/;
11  
12 -    unlink $stream_filename if ($is_tmpfile);
13 +    if ($is_tmpfile) {
14 +        unlink $stream_filename
15 +          or Perl::Tidy::Die("couldn't unlink stream $stream_filename: $!\n");
16 +    }
17      return $stream_filename, $msg;
18  }
19  
20 @@ -4128,7 +4143,11 @@ sub new {
21  
22      # remove any old error output file if we might write a new one
23      unless ( $fh_warnings || ref($warning_file) ) {
24 -        if ( -e $warning_file ) { unlink($warning_file) }
25 +        if ( -e $warning_file ) {
26 +            unlink($warning_file)
27 +              or Perl::Tidy::Die(
28 +                "couldn't unlink warning file $warning_file: $!\n");
29 +        }
30      }
31  
32      my $logfile_gap =