From fb92f29cb0c6ba6b0bd309e0fc5b99144bc41249 Mon Sep 17 00:00:00 2001 From: Alexander Lutay Date: Tue, 20 Nov 2018 14:08:16 +0100 Subject: [PATCH] TT#47373 Preserve config.yml attributes on copying for debug_mode Otherwise kamailio-config-test reset file perms from 0600 to 0755. From https://perldoc.perl.org/File/Copy.html : > You may use the syntax use File::Copy "cp" to > get at the cp alias for this function. The syntax is exactly the same. > The behavior is nearly the same as well: as of version 2.15, > cp will preserve the source file's permission bits like the > shell utility cp(1) would do, while copy uses the default > permissions for the target file > (which may depend on the process' umask, file ownership, inherited ACLs, etc.). > If an error occurs in setting permissions, cp will return 0, > regardless of whether the file was successfully copied. Change-Id: I7b227cb554699d68f809d38c82344d8f1afeed99 --- bin/config_debug.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/config_debug.pl b/bin/config_debug.pl index 1de4aa63..728ee98f 100755 --- a/bin/config_debug.pl +++ b/bin/config_debug.pl @@ -19,7 +19,7 @@ # Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". # use English; -use File::Copy; +use File::Copy qw(cp move); use File::Spec; use Getopt::Long; use strict; @@ -99,7 +99,7 @@ if (lc($action) eq "off") } else { - copy($file, $file.".orig") or die "Copy failed: $ERRNO" unless(-e $file.".orig"); + cp($file, $file.".orig") or die "Copy failed: $ERRNO" unless(-e $file.".orig"); $yaml = LoadFile($file); $yaml->{kamailio}{lb}{cfgt} = 'yes'; $yaml->{kamailio}{lb}{dns}{use_dns_cache} = 'off';