diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 78f24696..e6a539f9 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -94,6 +94,7 @@ jobs: uses: hendrikmuhs/ccache-action@v1 with: key: pg-${{ matrix.pg_version }} + append-timestamp: false - name: Create PostgreSQL directory run: sudo mkdir -p $PGHOME && sudo chown $USER $PGHOME @@ -244,6 +245,7 @@ jobs: uses: hendrikmuhs/ccache-action@v1 with: key: pg-${{ matrix.pg_version }} + append-timestamp: false - name: Create PostgreSQL directory run: sudo mkdir -p $PGHOME && sudo chown $USER $PGHOME diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 415eb224..9d63dcd7 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -36,53 +36,6 @@ jobs: cppcheck \ --error-exitcode=1 \ --suppress=missingIncludeSystem \ + --suppress=unknownMacro \ --quiet \ src/ - - clang-analyzer: - name: Clang Static Analyzer - runs-on: ubuntu-24.04 - env: - PGHOME: /pg - steps: - - uses: actions/checkout@v4 - - - name: Install dependencies - run: | - sudo apt-get update - sudo apt-get install -y \ - clang clang-tools \ - build-essential \ - libreadline-dev \ - zlib1g-dev \ - libzstd-dev \ - liblz4-dev \ - libssl-dev \ - bison flex - - - name: Clone PostgreSQL - run: | - git clone https://github.com/postgres/postgres.git \ - -b REL_17_STABLE --depth=1 - - - name: Build PostgreSQL - run: | - sudo mkdir -p $PGHOME && sudo chown $USER $PGHOME - cd postgres - ./configure --prefix=$PGHOME --without-icu - make -s -j$(nproc) install - - - name: Run Clang Static Analyzer - run: | - export PATH=$PGHOME/bin:$PATH - export PG_CONFIG=$(which pg_config) - scan-build --status-bugs -o scan-results \ - make USE_PGXS=1 top_srcdir=$GITHUB_WORKSPACE/postgres clean all - - - name: Upload analysis results - if: failure() - uses: actions/upload-artifact@v4 - with: - name: clang-analyzer-results - path: scan-results/ - retention-days: 7 diff --git a/src/archive.c b/src/archive.c index b1c4ea34..2604cd31 100644 --- a/src/archive.c +++ b/src/archive.c @@ -348,6 +348,12 @@ push_file(WALSegno *xlogfile, const char *archive_status_dir, rc = push_file_internal_gz(xlogfile, pg_xlog_dir, archive_dir, overwrite, no_sync, compress_level, archive_timeout); +#else + else + { + elog(ERROR, "Compression requested but pg_probackup was built without zlib support"); + rc = 1; /* Not reached, but keeps compiler happy */ + } #endif pg_atomic_write_u32(&xlogfile->done, 1); diff --git a/src/data.c b/src/data.c index 544adf18..ef3325c1 100644 --- a/src/data.c +++ b/src/data.c @@ -1651,6 +1651,7 @@ validate_file_pages(pgFile *file, const char *fullpath, XLogRecPtr stop_lsn, if (!headers && file->n_headers > 0) { elog(WARNING, "Cannot get page headers for file \"%s\"", fullpath); + fclose(in); return false; } @@ -1736,6 +1737,7 @@ validate_file_pages(pgFile *file, const char *fullpath, XLogRecPtr stop_lsn, { elog(WARNING, "Cannot read block %u file \"%s\": %s", blknum, fullpath, strerror(errno)); + fclose(in); return false; } @@ -1763,6 +1765,7 @@ validate_file_pages(pgFile *file, const char *fullpath, XLogRecPtr stop_lsn, { elog(WARNING, "An error occured during decompressing block %u of file \"%s\": %s", blknum, fullpath, errormsg); + fclose(in); return false; } @@ -1775,6 +1778,7 @@ validate_file_pages(pgFile *file, const char *fullpath, XLogRecPtr stop_lsn, } elog(WARNING, "Page %u of file \"%s\" uncompressed to %d bytes. != BLCKSZ", blknum, fullpath, uncompressed_size); + fclose(in); return false; } diff --git a/src/utils/file.c b/src/utils/file.c index b49c97d0..504694e5 100644 --- a/src/utils/file.c +++ b/src/utils/file.c @@ -3808,7 +3808,7 @@ fio_communicate(int in, int out) if (hdr.size > buf_size) { /* Extend buffer on demand */ buf_size = hdr.size; - buf = (char*)realloc(buf, buf_size); + buf = (char*)pgut_realloc(buf, buf_size); } IO_CHECK(fio_read_all(in, buf, hdr.size), hdr.size); } @@ -3863,7 +3863,7 @@ fio_communicate(int in, int out) case FIO_READ: /* Read from the current position in file */ if ((size_t)hdr.arg > buf_size) { buf_size = hdr.arg; - buf = (char*)realloc(buf, buf_size); + buf = (char*)pgut_realloc(buf, buf_size); } rc = read(fd[hdr.handle], buf, hdr.arg); hdr.cop = FIO_SEND; @@ -3999,7 +3999,7 @@ fio_communicate(int in, int out) size_t filename_size = (size_t)hdr.size; if (filename_size + hdr.arg > buf_size) { buf_size = hdr.arg; - buf = (char*)realloc(buf, buf_size); + buf = (char*)pgut_realloc(buf, buf_size); } rc = readlink(buf, buf + filename_size, hdr.arg); hdr.cop = FIO_READLINK; diff --git a/src/validate.c b/src/validate.c index 3bff3f75..414fc781 100644 --- a/src/validate.c +++ b/src/validate.c @@ -486,7 +486,7 @@ do_validate_instance(InstanceState *instanceState) /* Examine backups one by one and validate them */ for (i = 0; i < parray_num(backups); i++) { - pgBackup *base_full_backup; + pgBackup *base_full_backup = NULL; current_backup = (pgBackup *) parray_get(backups, i); @@ -559,11 +559,7 @@ do_validate_instance(InstanceState *instanceState) /* chain is whole, all parents are valid at first glance, * current backup validation can proceed */ - else - base_full_backup = tmp_backup; } - else - base_full_backup = current_backup; /* Do not interrupt, validate the next backup */ if (!lock_backup(current_backup, true, false))