Bug 252560 - ports-mgmt/pkg chef regression: exit code is 1 instead of 70 for info when package does not exist
Summary: ports-mgmt/pkg chef regression: exit code is 1 instead of 70 for info when pa...
Status: Closed Works As Intended
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-pkg (Nobody)
Depends on:
Reported: 2021-01-10 17:42 UTC by Pavel Merdin
Modified: 2021-08-17 15:18 UTC (History)
2 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 Pavel Merdin 2021-01-10 17:42:18 UTC
It looks like pkg started returning exit code 1 for 'info package' when the package does not exists. Previous versions used to return 70 in the same situation.
This seems to break chef automation as chef code expects either 0 or 70:


It looks like there is a bug #252125 which reports a similar issue with exit code, but in a different case.
I wonder if exit codes were somehow broken in the last release
Comment 1 Pavel Merdin 2021-01-10 17:53:52 UTC
a# pkg --version; pkg info pyjamas; echo $?
pkg: No package(s) matching pyjamas

b# pkg --version; pkg info pyjamas; echo $?
pkg: No package(s) matching pyjamas
Comment 2 Pavel Merdin 2021-01-10 18:26:07 UTC
  * freebsd_package[mc] action remove

    Error executing action `remove` on resource 'freebsd_package[mc]'

    Expected process to exit with [0, 70], but received '1'
    ---- Begin output of ["pkg", "info", "mc"] ----
    STDERR: pkg: No package(s) matching mc
    ---- End output of ["pkg", "info", "mc"] ----
    Ran ["pkg", "info", "mc"] returned 1
Comment 3 Baptiste Daroussin freebsd_committer freebsd_triage 2021-08-17 15:18:36 UTC
I missed that ticket, exit code have been changed, to saner model on purpose. It was part of the release note.