From 9e7189dfe3ee9e04bb943186ec55e10fb38ba56a Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Thu, 30 May 2019 15:47:16 -0700 Subject: [PATCH] cleanups before release --- CHANGES.md | 2 +- lib/Perl/Tidy.pm | 26 ++++++++++++++------------ 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index e81e4d2c..54f577f8 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -12,7 +12,7 @@ - Merged patch to fix Windows EOL translation error with UTF-8 written by Ron Ivy. This update prevents automatic conversion to 'DOS' CRLF line - endings. + endings. Also, Windows system testing at the appveyor site is working again. - RT #128280, added flag --one-line-block-semicolons=n (-olbs=n) to control semicolons in one-line blocks. The values of n are: diff --git a/lib/Perl/Tidy.pm b/lib/Perl/Tidy.pm index bc2c1a12..69f7f8c5 100644 --- a/lib/Perl/Tidy.pm +++ b/lib/Perl/Tidy.pm @@ -1350,18 +1350,20 @@ EOM } } - # Make the output file writable unless we are in -b mode. - # The reason is that perltidy does not unlink existing - # output files before writing to them, for safety, so if an - # existing output file is marked not writable then perltidy - # will stop. This can prevent a disaster for a user who - # accidentally enters "-o important_data", but it also - # means that perltidy may fail when rerun with its default - # output file unless it marks its own output files - # writable. The alternative, of always unlinking the - # designated output file, is unsafe, except in -b mode, - # where there is an assumption that a previous backup can - # be unlinked even if not writable. + # Make the output file for read + write unless we are in -b mode. + # Explanation: perltidy does not unlink existing output + # files before writing to them, for safety. If a designated + # output file exists and is not writable, perltidy will halt. + # This can prevent a data loss if a user + # accidentally enters "perltidy infile -o + # important_ro_file", or "perltidy infile -st + # >important_ro_file". But it also means that perltidy can + # get locked out of rerunning unless it marks its own + # output files writable. The alternative, of always + # unlinking the designated output + # file, is less safe and not always possible, except in -b + # mode, where there is an assumption that a previous backup + # can be unlinked even if not writable. if ( !$in_place_modify ) { $output_file_permissions |= oct(600); } -- 2.39.5