Skip Menu |
Report information
Id: 132773
Status: resolved
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors: konkove [at] gmail.com
Cc:
AdminCc:

Operating System: (no value)
PatchStatus: (no value)
Severity: low
Type: unknown
Perl Version: (no value)
Fixed In: (no value)

Attachments
0006-perlbug-Ask-confirmation-if-would-overwrite-existing.patch



To: perlbug [...] perl.org
Subject: perlbug overwrite existing perlbug.rep without notice
From: Eugen Konkov <konkove [...] gmail.com>
Date: Sat, 27 Jan 2018 12:33:32 +0200
CC: kes-kes [...] yandex.ru
Download (untitled) / with headers
text/plain 374b
Hi. 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 unexisting file name. For example: perlbug2.rep
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 523b
On Sat, 27 Jan 2018 02:33:37 -0800, konkove@gmail.com wrote: Show quoted text
> Hi. > > 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 > unexisting file name. > For example: perlbug2.rep
How about the attached patch? -- Karl Williamson
Subject: 0006-perlbug-Ask-confirmation-if-would-overwrite-existing.patch
From 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
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 157b
Since I didn't get feedback, and the deadline for 5.28 is upon us, I pushed that patch as commit fbb64cf55d4ec47a6b340862d7902f06b7a1ddc8 -- Karl Williamson
Download (untitled) / with headers
text/plain 317b
Thank 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 resolved. Perl 5.28.0 may be downloaded via: https://metacpan.org/release/XSAWYERX/perl-5.28.0 If you find that the problem persists, feel free to reopen this ticket.


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

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org