Open jhgit opened 2 years ago
Here are the problems:
root@deblndw013x3j:/usr/ports/ports-mgmt/pkg/work/pkg-1.19.0
# grep -r -e "pkg, PKG_SCRIPT_POST_INSTALL" -e "pkg, PKG_SCRIPT_PRE_INSTALL" .
./libpkg/pkg_add.c: pkg_script_run(pkg, PKG_SCRIPT_POST_INSTALL, (local != NULL));
./libpkg/pkg_ports.c: pkg_script_run(pkg, PKG_SCRIPT_PRE_INSTALL, false);
./libpkg/pkg_ports.c: pkg_script_run(pkg, PKG_SCRIPT_POST_INSTALL, false);
They just ignore the return code.
Boils down to: https://github.com/freebsd/pkg/blob/6c55d7bfc0e88ddeb8c4538ae347cd0d208df390/libpkg/pkg_add.c#L1359-L1362 https://github.com/freebsd/pkg/blob/6c55d7bfc0e88ddeb8c4538ae347cd0d208df390/libpkg/pkg_ports.c#L1215-L1234
If the pre-install or post-install script for a package fails,
pkg register
ignores the failure.pkg add
dies as I would expect.Looking in like libpkg/pkg_ports:pkg_add_port(), indeed the functions that are invoked to run the scripts (e.g., pkg_lua_script_run, pkg_script_run) do ignore the return code, whereas libpkg/pkg_add.c:pkg_add_common() checks the script return code.
See also https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=206951