1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-07-17 01:12:23 +02:00

Changed permission to mode in manifest.

This commit is contained in:
David Steele
2015-03-23 17:17:43 -04:00
parent 8a3c6388b2
commit 58d6c37f4a
8 changed files with 55 additions and 55 deletions

View File

@ -101,7 +101,7 @@ while ($strCommand ne OP_EXIT)
param_get(\%oParamHash, 'destination_compress'), param_get(\%oParamHash, 'destination_compress'),
param_get(\%oParamHash, 'ignore_missing_source', false), param_get(\%oParamHash, 'ignore_missing_source', false),
undef, undef,
param_get(\%oParamHash, 'permission', false), param_get(\%oParamHash, 'mode', false),
param_get(\%oParamHash, 'destination_path_create') ? 'Y' : 'N', param_get(\%oParamHash, 'destination_path_create') ? 'Y' : 'N',
param_get(\%oParamHash, 'user', false), param_get(\%oParamHash, 'user', false),
param_get(\%oParamHash, 'group', false), param_get(\%oParamHash, 'group', false),
@ -116,7 +116,7 @@ while ($strCommand ne OP_EXIT)
param_get(\%oParamHash, 'source_compressed'), param_get(\%oParamHash, 'source_compressed'),
param_get(\%oParamHash, 'destination_compress'), param_get(\%oParamHash, 'destination_compress'),
undef, undef, undef, undef,
param_get(\%oParamHash, 'permission', false), param_get(\%oParamHash, 'mode', false),
param_get(\%oParamHash, 'destination_path_create'), param_get(\%oParamHash, 'destination_path_create'),
param_get(\%oParamHash, 'user', false), param_get(\%oParamHash, 'user', false),
param_get(\%oParamHash, 'group', false), param_get(\%oParamHash, 'group', false),
@ -158,7 +158,7 @@ while ($strCommand ne OP_EXIT)
# Create a path # Create a path
elsif ($strCommand eq OP_FILE_PATH_CREATE) elsif ($strCommand eq OP_FILE_PATH_CREATE)
{ {
$oFile->path_create(PATH_ABSOLUTE, param_get(\%oParamHash, 'path'), param_get(\%oParamHash, 'permission', false)); $oFile->path_create(PATH_ABSOLUTE, param_get(\%oParamHash, 'path'), param_get(\%oParamHash, 'mode', false));
$oRemote->output_write(); $oRemote->output_write();
} }
# Check if a file/path exists # Check if a file/path exists
@ -178,7 +178,7 @@ while ($strCommand ne OP_EXIT)
$oFile->manifest(PATH_ABSOLUTE, param_get(\%oParamHash, 'path'), \%oManifestHash); $oFile->manifest(PATH_ABSOLUTE, param_get(\%oParamHash, 'path'), \%oManifestHash);
my $strOutput = "name\ttype\tuser\tgroup\tpermission\tmodification_time\tinode\tsize\tlink_destination"; my $strOutput = "name\ttype\tuser\tgroup\tmode\tmodification_time\tinode\tsize\tlink_destination";
foreach my $strName (sort(keys $oManifestHash{name})) foreach my $strName (sort(keys $oManifestHash{name}))
{ {
@ -186,7 +186,7 @@ while ($strCommand ne OP_EXIT)
$oManifestHash{name}{"${strName}"}{type} . "\t" . $oManifestHash{name}{"${strName}"}{type} . "\t" .
(defined($oManifestHash{name}{"${strName}"}{user}) ? $oManifestHash{name}{"${strName}"}{user} : "") . "\t" . (defined($oManifestHash{name}{"${strName}"}{user}) ? $oManifestHash{name}{"${strName}"}{user} : "") . "\t" .
(defined($oManifestHash{name}{"${strName}"}{group}) ? $oManifestHash{name}{"${strName}"}{group} : "") . "\t" . (defined($oManifestHash{name}{"${strName}"}{group}) ? $oManifestHash{name}{"${strName}"}{group} : "") . "\t" .
(defined($oManifestHash{name}{"${strName}"}{permission}) ? $oManifestHash{name}{"${strName}"}{permission} : "") . "\t" . (defined($oManifestHash{name}{"${strName}"}{mode}) ? $oManifestHash{name}{"${strName}"}{mode} : "") . "\t" .
(defined($oManifestHash{name}{"${strName}"}{modification_time}) ? (defined($oManifestHash{name}{"${strName}"}{modification_time}) ?
$oManifestHash{name}{"${strName}"}{modification_time} : "") . "\t" . $oManifestHash{name}{"${strName}"}{modification_time} : "") . "\t" .
(defined($oManifestHash{name}{"${strName}"}{inode}) ? $oManifestHash{name}{"${strName}"}{inode} : "") . "\t" . (defined($oManifestHash{name}{"${strName}"}{inode}) ? $oManifestHash{name}{"${strName}"}{inode} : "") . "\t" .

View File

@ -1011,7 +1011,7 @@ sub backup_file_thread
$bCompress, # Destination should be compressed based on backup settings $bCompress, # Destination should be compressed based on backup settings
true, # Ignore missing files true, # Ignore missing files
$oFileCopyMap{$strFile}{modification_time}, # Set modification time $oFileCopyMap{$strFile}{modification_time}, # Set modification time
undef, # Do not set original permissions undef, # Do not set original mode
true); # Create the destination directory if it does not exist true); # Create the destination directory if it does not exist
if (!$bCopyResult) if (!$bCopyResult)

View File

@ -104,8 +104,8 @@ sub new
my $strBackupPath = shift; my $strBackupPath = shift;
my $strRemote = shift; my $strRemote = shift;
my $oRemote = shift; my $oRemote = shift;
my $strDefaultPathPermission = shift; my $strDefaultPathMode = shift;
my $strDefaultFilePermission = shift; my $strDefaultFileMode = shift;
my $iThreadIdx = shift; my $iThreadIdx = shift;
# Create the class hash # Create the class hash
@ -115,9 +115,9 @@ sub new
# Default compression extension to gz # Default compression extension to gz
$self->{strCompressExtension} = 'gz'; $self->{strCompressExtension} = 'gz';
# Default file and path permissions # Default file and path mode
$self->{strDefaultPathPermission} = defined($strDefaultPathPermission) ? $strDefaultPathPermission : '0750'; $self->{strDefaultPathMode} = defined($strDefaultPathMode) ? $strDefaultPathMode : '0750';
$self->{strDefaultFilePermission} = defined($strDefaultFilePermission) ? $strDefaultFilePermission : '0640'; $self->{strDefaultFileMode} = defined($strDefaultFileMode) ? $strDefaultFileMode : '0640';
# Initialize other variables # Initialize other variables
$self->{strStanza} = $strStanza; $self->{strStanza} = $strStanza;
@ -173,8 +173,8 @@ sub clone
$self->{strBackupPath}, $self->{strBackupPath},
$self->{strRemote}, $self->{strRemote},
defined($self->{oRemote}) ? $self->{oRemote}->clone() : undef, defined($self->{oRemote}) ? $self->{oRemote}->clone() : undef,
$self->{strDefaultPathPermission}, $self->{strDefaultPathMode},
$self->{strDefaultFilePermission}, $self->{strDefaultFileMode},
$iThreadIdx $iThreadIdx
); );
} }
@ -558,7 +558,7 @@ sub path_create
# Set operation and debug strings # Set operation and debug strings
my $strOperation = OP_FILE_PATH_CREATE; my $strOperation = OP_FILE_PATH_CREATE;
my $strDebug = " ${strPathType}:${strPathOp}, permission " . (defined($strMode) ? $strMode : '[undef]'); my $strDebug = " ${strPathType}:${strPathOp}, mode " . (defined($strMode) ? $strMode : '[undef]');
&log(DEBUG, "${strOperation}: ${strDebug}"); &log(DEBUG, "${strOperation}: ${strDebug}");
if ($self->is_remote($strPathType)) if ($self->is_remote($strPathType))
@ -570,7 +570,7 @@ sub path_create
if (defined($strMode)) if (defined($strMode))
{ {
$oParamHash{permission} = ${strMode}; $oParamHash{mode} = ${strMode};
} }
# Add remote info to debug string # Add remote info to debug string
@ -1257,10 +1257,10 @@ sub manifest_recurse
# Get group name # Get group name
${$oManifestHashRef}{name}{"${strFile}"}{group} = getgrgid($oStat->gid); ${$oManifestHashRef}{name}{"${strFile}"}{group} = getgrgid($oStat->gid);
# Get permissions # Get mode
if (${$oManifestHashRef}{name}{"${strFile}"}{type} ne 'l') if (${$oManifestHashRef}{name}{"${strFile}"}{type} ne 'l')
{ {
${$oManifestHashRef}{name}{"${strFile}"}{permission} = sprintf('%04o', S_IMODE($oStat->mode)); ${$oManifestHashRef}{name}{"${strFile}"}{mode} = sprintf('%04o', S_IMODE($oStat->mode));
} }
# Recurse into directories # Recurse into directories
@ -1458,7 +1458,7 @@ sub copy
if (defined($strMode)) if (defined($strMode))
{ {
$oParamHash{permission} = $strMode; $oParamHash{mode} = $strMode;
} }
if (defined($strUser)) if (defined($strUser))
@ -1492,7 +1492,7 @@ sub copy
if (defined($strMode)) if (defined($strMode))
{ {
$oParamHash{permission} = $strMode; $oParamHash{mode} = $strMode;
} }
if (defined($strUser)) if (defined($strUser))
@ -1657,14 +1657,14 @@ sub copy
confess &log(ASSERT, "${strDebug}: checksum or file size not set"); confess &log(ASSERT, "${strDebug}: checksum or file size not set");
} }
# Where the destination is local, set permissions, modification time, and perform move to final location # Where the destination is local, set mode, modification time, and perform move to final location
if ($bResult && !$bDestinationRemote) if ($bResult && !$bDestinationRemote)
{ {
# Set the file permission if required # Set the file Mode if required
if (defined($strMode)) if (defined($strMode))
{ {
chmod(oct($strMode), $strDestinationTmpOp) chmod(oct($strMode), $strDestinationTmpOp)
or confess &log(ERROR, "unable to set permissions for local ${strDestinationTmpOp}"); or confess &log(ERROR, "unable to set mode for local ${strDestinationTmpOp}");
} }
# Set the file modification time if required # Set the file modification time if required

View File

@ -74,7 +74,7 @@ use constant
MANIFEST_SUBKEY_FUTURE => 'future', MANIFEST_SUBKEY_FUTURE => 'future',
MANIFEST_SUBKEY_GROUP => 'group', MANIFEST_SUBKEY_GROUP => 'group',
MANIFEST_SUBKEY_LINK => 'link', MANIFEST_SUBKEY_LINK => 'link',
MANIFEST_SUBKEY_MODE => 'permission', MANIFEST_SUBKEY_MODE => 'mode',
MANIFEST_SUBKEY_MODIFICATION_TIME => 'modification_time', MANIFEST_SUBKEY_MODIFICATION_TIME => 'modification_time',
MANIFEST_SUBKEY_PATH => 'path', MANIFEST_SUBKEY_PATH => 'path',
MANIFEST_SUBKEY_REFERENCE => 'reference', MANIFEST_SUBKEY_REFERENCE => 'reference',
@ -620,7 +620,7 @@ sub build
# Mode for required file and path type only # Mode for required file and path type only
if ($cType eq 'f' || $cType eq 'd') if ($cType eq 'f' || $cType eq 'd')
{ {
$self->set($strSection, $strName, MANIFEST_SUBKEY_MODE, $oManifestHash{name}{"${strName}"}{permission}); $self->set($strSection, $strName, MANIFEST_SUBKEY_MODE, $oManifestHash{name}{"${strName}"}{mode});
} }
# Modification time and size required for file type only # Modification time and size required for file type only

View File

@ -334,7 +334,7 @@ sub clean
{ {
my $strMode = $oManifest->get($strSection, $strName, MANIFEST_SUBKEY_MODE); my $strMode = $oManifest->get($strSection, $strName, MANIFEST_SUBKEY_MODE);
if ($strType ne MANIFEST_LINK && $strMode ne $oPathManifest{name}{$strName}{permission}) if ($strType ne MANIFEST_LINK && $strMode ne $oPathManifest{name}{$strName}{mode})
{ {
&log(DEBUG, "setting ${strFile} mode to ${strMode}"); &log(DEBUG, "setting ${strFile} mode to ${strMode}");
@ -651,7 +651,7 @@ sub restore_thread
# When a KILL signal is received, immediately abort # When a KILL signal is received, immediately abort
$SIG{'KILL'} = sub {threads->exit();}; $SIG{'KILL'} = sub {threads->exit();};
# Get the current user and group to compare with stored permissions # Get the current user and group to compare with stored mode
my $strCurrentUser = getpwuid($<); my $strCurrentUser = getpwuid($<);
my $strCurrentGroup = getgrgid($(); my $strCurrentGroup = getgrgid($();

View File

@ -421,7 +421,7 @@ sub BackRestTestBackup_ManifestPathCreate
# Load file into manifest # Load file into manifest
${$oManifestRef}{"${strPath}:path"}{$strManifestPath}{group} = getgrgid($oStat->gid); ${$oManifestRef}{"${strPath}:path"}{$strManifestPath}{group} = getgrgid($oStat->gid);
${$oManifestRef}{"${strPath}:path"}{$strManifestPath}{user} = getpwuid($oStat->uid); ${$oManifestRef}{"${strPath}:path"}{$strManifestPath}{user} = getpwuid($oStat->uid);
${$oManifestRef}{"${strPath}:path"}{$strManifestPath}{permission} = sprintf('%04o', S_IMODE($oStat->mode)); ${$oManifestRef}{"${strPath}:path"}{$strManifestPath}{mode} = sprintf('%04o', S_IMODE($oStat->mode));
} }
#################################################################################################################################### ####################################################################################################################################
@ -476,7 +476,7 @@ sub BackRestTestBackup_ManifestTablespaceCreate
# Load path into manifest # Load path into manifest
${$oManifestRef}{"tablespace:${iOid}:path"}{'.'}{group} = getgrgid($oStat->gid); ${$oManifestRef}{"tablespace:${iOid}:path"}{'.'}{group} = getgrgid($oStat->gid);
${$oManifestRef}{"tablespace:${iOid}:path"}{'.'}{user} = getpwuid($oStat->uid); ${$oManifestRef}{"tablespace:${iOid}:path"}{'.'}{user} = getpwuid($oStat->uid);
${$oManifestRef}{"tablespace:${iOid}:path"}{'.'}{permission} = sprintf('%04o', S_IMODE($oStat->mode)); ${$oManifestRef}{"tablespace:${iOid}:path"}{'.'}{mode} = sprintf('%04o', S_IMODE($oStat->mode));
# Create the link in pg_tblspc # Create the link in pg_tblspc
my $strLink = BackRestTestCommon_DbCommonPathGet() . "/pg_tblspc/${iOid}"; my $strLink = BackRestTestCommon_DbCommonPathGet() . "/pg_tblspc/${iOid}";
@ -584,7 +584,7 @@ sub BackRestTestBackup_ManifestFileCreate
# Load file into manifest # Load file into manifest
${$oManifestRef}{"${strPath}:file"}{$strFile}{group} = getgrgid($oStat->gid); ${$oManifestRef}{"${strPath}:file"}{$strFile}{group} = getgrgid($oStat->gid);
${$oManifestRef}{"${strPath}:file"}{$strFile}{user} = getpwuid($oStat->uid); ${$oManifestRef}{"${strPath}:file"}{$strFile}{user} = getpwuid($oStat->uid);
${$oManifestRef}{"${strPath}:file"}{$strFile}{permission} = sprintf('%04o', S_IMODE($oStat->mode)); ${$oManifestRef}{"${strPath}:file"}{$strFile}{mode} = sprintf('%04o', S_IMODE($oStat->mode));
${$oManifestRef}{"${strPath}:file"}{$strFile}{modification_time} = $oStat->mtime; ${$oManifestRef}{"${strPath}:file"}{$strFile}{modification_time} = $oStat->mtime;
${$oManifestRef}{"${strPath}:file"}{$strFile}{size} = $oStat->size; ${$oManifestRef}{"${strPath}:file"}{$strFile}{size} = $oStat->size;
delete(${$oManifestRef}{"${strPath}:file"}{$strFile}{reference}); delete(${$oManifestRef}{"${strPath}:file"}{$strFile}{reference});
@ -949,7 +949,7 @@ sub BackRestTestBackup_BackupCompare
} }
} }
# Change permissions on the backup path so it can be read # Change mode on the backup path so it can be read
if ($bRemote) if ($bRemote)
{ {
BackRestTestCommon_Execute('chmod 750 ' . BackRestTestCommon_RepoPathGet(), true); BackRestTestCommon_Execute('chmod 750 ' . BackRestTestCommon_RepoPathGet(), true);
@ -971,7 +971,7 @@ sub BackRestTestBackup_BackupCompare
BackRestTestCommon_Execute("diff ${strTestPath}/expected.manifest ${strTestPath}/actual.manifest"); BackRestTestCommon_Execute("diff ${strTestPath}/expected.manifest ${strTestPath}/actual.manifest");
# Change permissions on the backup path back before unit tests continue # Change mode on the backup path back before unit tests continue
if ($bRemote) if ($bRemote)
{ {
BackRestTestCommon_Execute('chmod 700 ' . BackRestTestCommon_RepoPathGet(), true); BackRestTestCommon_Execute('chmod 700 ' . BackRestTestCommon_RepoPathGet(), true);
@ -1003,7 +1003,7 @@ sub BackRestTestBackup_ManifestMunge
confess &log(ASSERT, 'strSection and strKey must be defined'); confess &log(ASSERT, 'strSection and strKey must be defined');
} }
# Change permissions on the backup path so it can be read/written # Change mode on the backup path so it can be read/written
if ($bRemote) if ($bRemote)
{ {
BackRestTestCommon_Execute('chmod 750 ' . BackRestTestCommon_RepoPathGet(), true); BackRestTestCommon_Execute('chmod 750 ' . BackRestTestCommon_RepoPathGet(), true);
@ -1086,7 +1086,7 @@ sub BackRestTestBackup_ManifestMunge
# Resave the manifest # Resave the manifest
ini_save($oFile->path_get(PATH_BACKUP_CLUSTER, $strBackup) . '/backup.manifest', \%oManifest); ini_save($oFile->path_get(PATH_BACKUP_CLUSTER, $strBackup) . '/backup.manifest', \%oManifest);
# Change permissions on the backup path back before unit tests continue # Change mode on the backup path back before unit tests continue
if ($bRemote) if ($bRemote)
{ {
BackRestTestCommon_Execute('chmod 750 ' . $oFile->path_get(PATH_BACKUP_CLUSTER, $strBackup) . '/backup.manifest', true); BackRestTestCommon_Execute('chmod 750 ' . $oFile->path_get(PATH_BACKUP_CLUSTER, $strBackup) . '/backup.manifest', true);
@ -1137,7 +1137,7 @@ sub BackRestTestBackup_Restore
if (!defined($oExpectedManifestRef)) if (!defined($oExpectedManifestRef))
{ {
# Change permissions on the backup path so it can be read # Change mode on the backup path so it can be read
if ($bRemote) if ($bRemote)
{ {
BackRestTestCommon_Execute('chmod 750 ' . BackRestTestCommon_RepoPathGet(), true); BackRestTestCommon_Execute('chmod 750 ' . BackRestTestCommon_RepoPathGet(), true);
@ -1148,7 +1148,7 @@ sub BackRestTestBackup_Restore
$oExpectedManifestRef = $oExpectedManifest->{oManifest}; $oExpectedManifestRef = $oExpectedManifest->{oManifest};
# Change permissions on the backup path back before unit tests continue # Change mode on the backup path back before unit tests continue
if ($bRemote) if ($bRemote)
{ {
BackRestTestCommon_Execute('chmod 700 ' . BackRestTestCommon_RepoPathGet(), true); BackRestTestCommon_Execute('chmod 700 ' . BackRestTestCommon_RepoPathGet(), true);
@ -1203,7 +1203,7 @@ sub BackRestTestBackup_RestoreCompare
if (defined(${$oExpectedManifestRef}{'backup'}{'prior'})) if (defined(${$oExpectedManifestRef}{'backup'}{'prior'}))
{ {
# Change permissions on the backup path so it can be read # Change mode on the backup path so it can be read
if ($bRemote) if ($bRemote)
{ {
BackRestTestCommon_Execute('chmod 750 ' . BackRestTestCommon_RepoPathGet(), true); BackRestTestCommon_Execute('chmod 750 ' . BackRestTestCommon_RepoPathGet(), true);
@ -1216,7 +1216,7 @@ sub BackRestTestBackup_RestoreCompare
"/backup/${strStanza}/" . ${$oExpectedManifestRef}{'backup'}{'prior'} . "/backup/${strStanza}/" . ${$oExpectedManifestRef}{'backup'}{'prior'} .
'/backup.manifest', true); '/backup.manifest', true);
# Change permissions on the backup path back before unit tests continue # Change mode on the backup path back before unit tests continue
if ($bRemote) if ($bRemote)
{ {
BackRestTestCommon_Execute('chmod 700 ' . BackRestTestCommon_RepoPathGet(), true); BackRestTestCommon_Execute('chmod 700 ' . BackRestTestCommon_RepoPathGet(), true);
@ -1862,7 +1862,7 @@ sub BackRestTestBackup_Test
$strFullBackup = BackRestTestBackup_BackupSynthetic($strType, $strStanza, $bRemote, $oFile, \%oManifest, $strFullBackup = BackRestTestBackup_BackupSynthetic($strType, $strStanza, $bRemote, $oFile, \%oManifest,
'resume', TEST_BACKUP_RESUME); 'resume', TEST_BACKUP_RESUME);
# Restore - tests various permissions, extra files/paths, missing files/paths # Restore - tests various mode, extra files/paths, missing files/paths
#----------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------
my $bDelta = true; my $bDelta = true;
my $bForce = false; my $bForce = false;

View File

@ -296,7 +296,7 @@ sub BackRestTestCommon_PathCreate
mkdir($strPath) mkdir($strPath)
or confess "unable to create ${strPath} path"; or confess "unable to create ${strPath} path";
# Set the permissions # Set the mode
chmod(oct(defined($strMode) ? $strMode : '0700'), $strPath) chmod(oct(defined($strMode) ? $strMode : '0700'), $strPath)
or confess 'unable to set mode ${strMode} for ${strPath}'; or confess 'unable to set mode ${strMode} for ${strPath}';
} }
@ -311,7 +311,7 @@ sub BackRestTestCommon_PathMode
my $strPath = shift; my $strPath = shift;
my $strMode = shift; my $strMode = shift;
# Set the permissions # Set the mode
chmod(oct($strMode), $strPath) chmod(oct($strMode), $strPath)
or confess 'unable to set mode ${strMode} for ${strPath}'; or confess 'unable to set mode ${strMode} for ${strPath}';
} }
@ -405,7 +405,7 @@ sub BackRestTestCommon_FileCreate
or confess 'unable to set time ${lTime} for ${strPath}'; or confess 'unable to set time ${lTime} for ${strPath}';
} }
# Set the permissions # Set the mode
chmod(oct(defined($strMode) ? $strMode : '0600'), $strFile) chmod(oct(defined($strMode) ? $strMode : '0600'), $strFile)
or confess 'unable to set mode ${strMode} for ${strFile}'; or confess 'unable to set mode ${strMode} for ${strFile}';
} }

View File

@ -136,14 +136,14 @@ sub BackRestTestFile_Test
# Loop through error # Loop through error
for (my $bError = 0; $bError <= 1; $bError++) for (my $bError = 0; $bError <= 1; $bError++)
{ {
# Loop through permission (permission will be set on true) # Loop through mode (mode will be set on true)
for (my $bPermission = 0; $bPermission <= 1; $bPermission++) for (my $bMode = 0; $bMode <= 1; $bMode++)
{ {
my $strPathType = PATH_BACKUP_CLUSTER; my $strPathType = PATH_BACKUP_CLUSTER;
# Increment the run, log, and decide whether this unit test should be run # Increment the run, log, and decide whether this unit test should be run
if (!BackRestTestCommon_Run(++$iRun, if (!BackRestTestCommon_Run(++$iRun,
"rmt ${bRemote}, err ${bError}, prm ${bPermission}")) {next} "rmt ${bRemote}, err ${bError}, mode ${bMode}")) {next}
# Setup test directory # Setup test directory
BackRestTestFile_Setup($bError); BackRestTestFile_Setup($bError);
@ -152,12 +152,12 @@ sub BackRestTestFile_Test
mkdir("${strTestPath}/backup/db") or confess 'Unable to create test/backup/db directory'; mkdir("${strTestPath}/backup/db") or confess 'Unable to create test/backup/db directory';
my $strPath = 'path'; my $strPath = 'path';
my $strPermission; my $strMode;
# If permission then set one (other than the default) # If mode then set one (other than the default)
if ($bPermission) if ($bMode)
{ {
$strPermission = '0700'; $strMode = '0700';
} }
# If not exists then set the path to something bogus # If not exists then set the path to something bogus
@ -172,7 +172,7 @@ sub BackRestTestFile_Test
eval eval
{ {
$oFile->path_create($strPathType, $strPath, $strPermission); $oFile->path_create($strPathType, $strPath, $strMode);
}; };
# Check for errors # Check for errors
@ -200,7 +200,7 @@ sub BackRestTestFile_Test
confess 'path was not created'; confess 'path was not created';
} }
# Check that the permissions were set correctly # Check that the mode was set correctly
my $oStat = lstat($strPathCheck); my $oStat = lstat($strPathCheck);
if (!defined($oStat)) if (!defined($oStat))
@ -208,11 +208,11 @@ sub BackRestTestFile_Test
confess "unable to stat ${strPathCheck}"; confess "unable to stat ${strPathCheck}";
} }
if ($bPermission) if ($bMode)
{ {
if ($strPermission ne sprintf('%04o', S_IMODE($oStat->mode))) if ($strMode ne sprintf('%04o', S_IMODE($oStat->mode)))
{ {
confess "permissions were not set to {$strPermission}"; confess "mode were not set to {$strMode}";
} }
} }
} }
@ -601,8 +601,8 @@ sub BackRestTestFile_Test
$oManifestHash{name}{"${strName}"}{user} : '') . ',' . $oManifestHash{name}{"${strName}"}{user} : '') . ',' .
(defined($oManifestHash{name}{"${strName}"}{group}) ? (defined($oManifestHash{name}{"${strName}"}{group}) ?
$oManifestHash{name}{"${strName}"}{group} : '') . ',' . $oManifestHash{name}{"${strName}"}{group} : '') . ',' .
(defined($oManifestHash{name}{"${strName}"}{permission}) ? (defined($oManifestHash{name}{"${strName}"}{mode}) ?
$oManifestHash{name}{"${strName}"}{permission} : '') . ',' . $oManifestHash{name}{"${strName}"}{mode} : '') . ',' .
(defined($oManifestHash{name}{"${strName}"}{modification_time}) ? (defined($oManifestHash{name}{"${strName}"}{modification_time}) ?
$oManifestHash{name}{"${strName}"}{modification_time} : '') . ',' . $oManifestHash{name}{"${strName}"}{modification_time} : '') . ',' .
(defined($oManifestHash{name}{"${strName}"}{inode}) ? (defined($oManifestHash{name}{"${strName}"}{inode}) ?