16.06.2025 15:00, Daniel Gustafsson пишет:
On 16 Jun 2025, at 10:52, Evgeniy Gorbanev <gorbanyo...@basealt.ru> wrote:
16.06.2025 14:25, Daniel Gustafsson пишет:
On 16 Jun 2025, at 10:14, Evgeniy Gorbanev <gorbanyo...@basealt.ru> wrote:
In src/bin/pg_dump/compress_zstd.c, the Zstd_read function always
returns true. But if you look at the Zstd_gets and Zstd_getc functions,
where Zstd_read is called via CFH->read_func, it is expected that
the Zstd_read function can also return false. In case of
a read-from-file error, the process is expected to terminate, but
pg_dump will continue the process.
I assume that after checking
if (cnt == 0)
should be
return false;
if (cnt == 0)
- break;
+ return false;
As cnt is coming from fread() returning false here would be wrong as you cannot
from 0 alone know if it's EOF or an error. Instead it needs to inspect the
stream with feof() and ferror() to know how to proceed.
The feof() check is in the calling functions, e.g. in the Zstd_getc
function.
That function is using feof/ferror to log an appropriate error message, what
you are proposing is to consider all cases of EOF as an error. If you test
that you will see lots of test starting to fail.
--
Daniel Gustafsson
I ran tests for pg_dump and they all passed. Logs attached.
Please check.
make -C ../../../src/backend generated-headers
make[1]: вход в каталог «/home/user/postgres/src/backend»
make -C ../include/catalog generated-headers
make[2]: вход в каталог «/home/user/postgres/src/include/catalog»
make[2]: Цель «generated-headers» не требует выполнения команд.
make[2]: выход из каталога «/home/user/postgres/src/include/catalog»
make -C nodes generated-header-symlinks
make[2]: вход в каталог «/home/user/postgres/src/backend/nodes»
make[2]: Цель «generated-header-symlinks» не требует выполнения команд.
make[2]: выход из каталога «/home/user/postgres/src/backend/nodes»
make -C utils generated-header-symlinks
make[2]: вход в каталог «/home/user/postgres/src/backend/utils»
make -C adt jsonpath_gram.h
make[3]: вход в каталог «/home/user/postgres/src/backend/utils/adt»
make[3]: «jsonpath_gram.h» не требует обновления.
make[3]: выход из каталога «/home/user/postgres/src/backend/utils/adt»
make[2]: выход из каталога «/home/user/postgres/src/backend/utils»
make[1]: выход из каталога «/home/user/postgres/src/backend»
rm -rf '/home/user/postgres'/tmp_install
/bin/mkdir -p '/home/user/postgres'/tmp_install/log
make -C '../../..' DESTDIR='/home/user/postgres'/tmp_install install >'/home/user/postgres'/tmp_install/log/install.log 2>&1
make -j1 checkprep >>'/home/user/postgres'/tmp_install/log/install.log 2>&1
PATH="/home/user/postgres/tmp_install/home/user/postgres/buildroot/bin:/home/user/postgres/src/bin/pg_dump:$PATH" LD_LIBRARY_PATH="/home/user/postgres/tmp_install/home/user/postgres/buildroot/lib" INITDB_TEMPLATE='/home/user/postgres'/tmp_install/initdb-template initdb --auth trust --no-sync --no-instructions --lc-messages=C --no-clean '/home/user/postgres'/tmp_install/initdb-template >>'/home/user/postgres'/tmp_install/log/initdb-template.log 2>&1
echo "# +++ tap check in src/bin/pg_dump +++" && rm -rf '/home/user/postgres/src/bin/pg_dump'/tmp_check && /bin/mkdir -p '/home/user/postgres/src/bin/pg_dump'/tmp_check && cd . && TESTLOGDIR='/home/user/postgres/src/bin/pg_dump/tmp_check/log' TESTDATADIR='/home/user/postgres/src/bin/pg_dump/tmp_check' PATH="/home/user/postgres/tmp_install/home/user/postgres/buildroot/bin:/home/user/postgres/src/bin/pg_dump:$PATH" LD_LIBRARY_PATH="/home/user/postgres/tmp_install/home/user/postgres/buildroot/lib" INITDB_TEMPLATE='/home/user/postgres'/tmp_install/initdb-template PGPORT='65432' top_builddir='/home/user/postgres/src/bin/pg_dump/../../..' PG_REGRESS='/home/user/postgres/src/bin/pg_dump/../../../src/test/regress/pg_regress' share_contrib_dir='/home/user/postgres/tmp_install/home/user/postgres/buildroot/share/' /usr/bin/prove -I ../../../src/test/perl/ -I . t/*.pl
# +++ tap check in src/bin/pg_dump +++
t/001_basic.pl ................ ok
t/002_pg_dump.pl .............. ok
t/003_pg_dump_with_server.pl .. ok
t/004_pg_dump_parallel.pl ..... ok
t/005_pg_dump_filterfile.pl ... ok
t/006_pg_dumpall.pl ........... ok
t/010_dump_connstr.pl ......... ok
All tests successful.
Files=7, Tests=11918, 35 wallclock secs ( 0.59 usr 0.07 sys + 7.92 cusr 4.32 csys = 12.90 CPU)
Result: PASS