Bug 197748 - ports-mgmt/pkg: ignores error conditions at exit time
Summary: ports-mgmt/pkg: ignores error conditions at exit time
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-pkg (Nobody)
Depends on:
Reported: 2015-02-16 21:49 UTC by jgoerzen
Modified: 2017-12-17 07:12 UTC (History)
3 users (show)

See Also:
bugzilla: maintainer-feedback? (pkg)


Note You need to log in before you can comment on or make changes to this bug.
Description jgoerzen 2015-02-16 21:49:37 UTC
pkg reports certain errors, which scroll past, but does not provide an indication when it exits that errors occurred.

The other day, I ran a pkg install which included nspluginwrapper.  Apparently
I should have first run kldload linux before running pkg install
nspluginwrapper, but I didn't.

I happened to be capturing the output of the session under script(1),
but the only reason I knew anything was amiss was that I happened to
glance at the screen at the right time.  I got errors like:

[132/681] Installing linux_base-c6-6.6_3...
sysctl: unknown oid 'compat.linux.osrelease': No such file or directory
linuxulator is not (kld)loaded, exiting
pkg: PRE-INSTALL script failed

Extracting linux_base-c6-6.6_3: 100%

+++ Some programs may need linprocfs, please add it to /etc/fstab! +++

Running linux ldconfig...
ELF binary type "3" not known.
/compat/linux/sbin/ldconfig: Exec format error

Extracting linux-c6-expat-2.0.1_1: 100%
ELF binary type "3" not known.
/compat/linux/sbin/ldconfig: Exec format error
pkg: POST-INSTALL script failed

and so forth.  So all these pre-install and post-install scripts are
failing.  I assume this means the package isn't properly installed or
configured.  But:

# pkg install linux_base-c6
Updating FreeBSD repository catalogue...
FreeBSD repository is up-to-date.
All repositories are up-to-date.
Checking integrity... done (0 conflicting)
The most recent version of packages are already installed

I believe that, when pkg exits, it ought to display something like:

"Errors were encountered while processing: linux_base-c6-6.6_3, foo, bar, baz" and exit with a nonzero exit code, even if 200 packages came after those and installed correctly.  Otherwise, a person will not know if their packages failed unless they happen to glance at the screen at just the right time.

I originally reported this on a mailing list at http://article.gmane.org/gmane.os.freebsd.questions/311852

I can provide a full typescript of the session if that would be helpful.  It is on a brand-new 10.1-RELEASE installation.
Comment 1 Bugzilla Automation freebsd_committer 2015-02-16 21:49:37 UTC
Auto-assigned to maintainer portmgr@FreeBSD.org
Comment 2 Baptiste Daroussin freebsd_committer 2015-03-05 22:47:04 UTC
This is a tradeoff for now we accept failing scripts because too many of the scripts in the ports were failing when we started on pkg, it is plan to change that as we fixed most of them.

The technical debt accumulate over the time...
Comment 3 Baptiste Daroussin freebsd_committer 2016-05-22 15:26:54 UTC
post-install remains unchecked in pkg 1.8 will be checked in pkg 1.8.1 but pre-install are now correctly checked
Comment 4 vali gholami 2017-12-17 07:12:24 UTC