View Issue Details

IDProjectCategoryView StatusLast Update
0000636Perl for OS/2Feature Requestpublic2014-12-15 01:55
Reporterkomh Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Summary0000636: Use .bak if no extension is supplied to -i option
DescriptionHi/2.

The following command fails.

    perl -pi -e s/old/new/ file

An error message is

    Can't do inplace edit without backup.

If providing some extensions such as .bak, it will be happy.

    perl -pi.bak -e s/old/new/ file

However, adding .bak every time is very annoying. So using .bak by default will make many users happy.
TagsNo tags attached.
Attached Files
0001-Use-.bak-automatically-if-no-extension-is-supplied-t.patch (878 bytes)   
From 30ccfb6826be24890a94941e5494f4c8ba4a58e9 Mon Sep 17 00:00:00 2001
From: KO Myung-Hun <komh@chollian.net>
Date: Mon, 15 Dec 2014 10:40:58 +0900
Subject: [PATCH] Use .bak automatically if no extension is supplied to -i
 option

This fixes the following error when no extension is suppplied to
-i option.

-----
Can't do inplace edit without backup.
-----

    modified:   perl.c
---
 perl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/perl.c b/perl.c
index 1e09366..b8d5b1c 100644
--- a/perl.c
+++ b/perl.c
@@ -3174,7 +3174,7 @@ Perl_moreswitches(pTHX_ const char *s)
 	usage();
     case 'i':
 	Safefree(PL_inplace);
-#if defined(__CYGWIN__) /* do backup extension automagically */
+#if defined(__CYGWIN__) || defined(__OS2__) /* do backup extension automagically */
 	if (*(s+1) == '\0') {
 	PL_inplace = savepvs(".bak");
 	return s+1;
-- 
1.8.5.2

Activities

Issue History

Date Modified Username Field Change
2014-12-15 01:55 komh New Issue
2014-12-15 01:55 komh File Added: 0001-Use-.bak-automatically-if-no-extension-is-supplied-t.patch