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: New
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)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-10 17:42 UTC by Pavel Merdin
Modified: 2021-01-15 04:12 UTC (History)
2 users (show)

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


Attachments

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:

https://github.com/chef/chef/blob/master/lib/chef/provider/package/freebsd/pkgng.rb#L45

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 $?
1.16.1
pkg: No package(s) matching pyjamas
1

b# pkg --version; pkg info pyjamas; echo $?
1.15.10
pkg: No package(s) matching pyjamas
70
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]'
    ================================================================================

    Mixlib::ShellOut::ShellCommandFailed
    ------------------------------------
    Expected process to exit with [0, 70], but received '1'
    ---- Begin output of ["pkg", "info", "mc"] ----
    STDOUT:
    STDERR: pkg: No package(s) matching mc
    ---- End output of ["pkg", "info", "mc"] ----
    Ran ["pkg", "info", "mc"] returned 1