1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-10-30 23:37:45 +02:00

Check for stray execute permissions in test.pl --code-format.

Sometimes these can get set while updating permissions from with a VM or container.

Also fix a few permissions that were not correct.
This commit is contained in:
David Steele
2023-02-01 12:57:04 +07:00
parent 8e7e9d36a1
commit 31cad5e09e
4 changed files with 31 additions and 7 deletions

0
src/config/parse.auto.c.inc Executable file → Normal file
View File

0
test/lib/pgBackRestTest/Common/ContainerTest.pm Executable file → Normal file
View File

View File

@@ -617,13 +617,14 @@ eval
(trim(`uname`) ne 'Darwin' ? ' --ignore-missing-args' : '') .
" ${strBackRestBase}/ ${strRepoCachePath}");
# Format code with uncrustify
# Format code with uncrustify and check permissions
#---------------------------------------------------------------------------------------------------------------------------
if ($bCodeFormat || $bCodeFormatCheck)
{
&log(INFO, 'code format' . ($bCodeFormatCheck ? ' check' : ''));
my $hManifest = $oStorageTest->manifest($strRepoCachePath);
my $hRepoManifest = $oStorageTest->manifest($strRepoCachePath);
my $hManifest = $oStorageBackRest->manifest('');
my $strCommand =
"uncrustify -c ${strBackRestBase}/test/uncrustify.cfg" .
($bCodeFormatCheck ? ' --check' : ' --replace --no-backup');
@@ -633,11 +634,8 @@ eval
# Skip non-C files
next if $hManifest->{$strFile}{type} ne 'f' || ($strFile !~ /\.c$/ && $strFile !~ /\.h$/);
# Check mode
if ($hManifest->{$strFile}{mode} ne '0644')
{
confess &log(ERROR, "expected mode '0644' for '$strFile' but found '" . $hManifest->{$strFile}{mode} . "'");
}
# Skip files that do are not version controlled
next if !defined($hRepoManifest->{$strFile});
# Skip specific file
next if
@@ -652,6 +650,32 @@ eval
executeTest($strCommand . " 2>&1");
# Check execute permissions to make sure nothing got munged
foreach my $strFile (sort(keys(%{$hManifest})))
{
next if ($strFile eq '.') || !defined($hRepoManifest->{$strFile});
my $strExpectedMode = sprintf('%04o', oct($hManifest->{$strFile}{mode}) & 0666);
if ($strFile eq 'doc/doc.pl' ||
$strFile eq 'doc/release.pl' ||
$strFile eq 'src/build/install-sh' ||
$strFile eq 'src/configure' ||
$strFile eq 'test/ci.pl' ||
$strFile eq 'test/test.pl' ||
$hManifest->{$strFile}{type} eq 'd')
{
$strExpectedMode = sprintf('%04o', oct($hManifest->{$strFile}{mode}) & 0777);
}
if ($hManifest->{$strFile}{mode} ne $strExpectedMode)
{
confess &log(
ERROR,
"expected mode for '${strExpectedMode}' for '${strFile}' but found '" . $hManifest->{$strFile}{mode} . "'");
}
}
exit 0;
}

0
test/uncrustify.cfg Executable file → Normal file
View File