New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perlbug overwrite existing perlbug.rep without notice #16386
Comments
From konkove@gmail.comHi. When new report is created the `perlbug` suggest file name: Name of file to save message in [perlbug.rep]: But in case this file already exists it is overwrited without notice. Name of file to save message in [perlbug.rep]: Message saved. There should be some warning about that or it should suggest |
From @khwilliamsonOn Sat, 27 Jan 2018 02:33:37 -0800, konkove@gmail.com wrote:
How about the attached patch? |
From @khwilliamson0006-perlbug-Ask-confirmation-if-would-overwrite-existing.patchFrom 4374d262902bd8dfbaaee642169cc73560edf354 Mon Sep 17 00:00:00 2001
From: Karl Williamson <khw@cpan.org>
Date: Tue, 3 Apr 2018 10:27:25 -0600
Subject: [PATCH 6/6] perlbug: Ask confirmation if would overwrite existing
file
This adds a prompt asking for confirmation if the perlbug report would
overwrite an existing file. My guess is that the normal answer will be
yes.
---
utils/perlbug.PL | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/utils/perlbug.PL b/utils/perlbug.PL
index 3273902d0b..d1eb1e04a8 100644
--- a/utils/perlbug.PL
+++ b/utils/perlbug.PL
@@ -1122,6 +1122,10 @@ sub build_complete_message {
sub save_message_to_disk {
my $file = shift;
+ if (-e $file) {
+ my $response = _prompt( '', "Overwrite existing '$file'", 'n' );
+ return undef unless $response =~ / yes | y /xi;
+ }
open OUTFILE, '>:raw', $file or do { warn "Couldn't open '$file': $!\n"; return undef};
binmode(OUTFILE, ':raw :crlf') if $Is_MSWin32;
--
2.11.0
|
The RT System itself - Status changed from 'new' to 'open' |
From @khwilliamsonSince I didn't get feedback, and the deadline for 5.28 is upon us, I pushed that patch as commit fbb64cf |
@khwilliamson - Status changed from 'open' to 'pending release' |
From @khwilliamsonThank you for filing this report. You have helped make Perl better. With the release yesterday of Perl 5.28.0, this and 185 other issues have been Perl 5.28.0 may be downloaded via: If you find that the problem persists, feel free to reopen this ticket. |
@khwilliamson - Status changed from 'pending release' to 'resolved' |
Migrated from rt.perl.org#132773 (status was 'resolved')
Searchable as RT132773$
The text was updated successfully, but these errors were encountered: