Hi,

# drop ccing misc@

The diff seems ok for me.

ok to commit it in?

On Tue, 19 Oct 2021 10:42:04 +0900
Yuichiro NAITO <naito.yuich...@gmail.com> wrote:
> Following patch changes pkg_add to return a error code,
> if a package name is wrong.
> 
> diff --git a/usr.sbin/pkg_add/OpenBSD/AddDelete.pm
> b/usr.sbin/pkg_add/OpenBSD/AddDelete.pm
> index 7a968cbf05d..39bee874ff1 100644
> --- a/usr.sbin/pkg_add/OpenBSD/AddDelete.pm
> +++ b/usr.sbin/pkg_add/OpenBSD/AddDelete.pm
> @@ -403,12 +403,13 @@ sub check_root
>  sub choose_location
>  {
>       my ($state, $name, $list, $is_quirks) = @_;
>       if (@$list == 0) {
>               if (!$is_quirks) {
>                       $state->errsay("Can't find #1", $name);
> +                     $state->{bad}++;
>                       $state->run_quirks(
>                           sub {
>                               my $quirks = shift;
>                               $quirks->filter_obsolete([$name], $state);
>                           });
>               }
> 
> Is it OK?
> 
> On 10/18/21 16:53, Yuichiro NAITO wrote:
>> Hi, I have a question about exit status of pkg_add command.
>> When I wrote a package install script which included typo in a package
>> name
>> (of course it's my fault), the script didn't stop in spite of `set
>> -e`.
>> Because pkg_add command returns 0 even if a package name is wrong.
>> Is this exit status intended or design policy of pkg_add command?
>> If not, I want a error status getting returned.
>> It will save my time to look for a typo or similar bug.
>> I can't see 'EXIT STATUS' section in the pkg_add manual of OpenBSD
>> 7.0.
>> So, I e-mailed this question.
>> 
> 
> -- 
> Yuichiro NAITO (naito.yuich...@gmail.com)
> 

Reply via email to