Re: pkg_sign incorrectly assumes -i by default
On Mon, Jun 06, 2016 at 09:12:04AM +0200, Marc Espie wrote: > > This should fix things. Thanks, things work as expected here with this diff. > > > Index: AddCreateDelete.pm > === > RCS file: /cvs/src/usr.sbin/pkg_add/OpenBSD/AddCreateDelete.pm,v > retrieving revision 1.34 > diff -u -p -r1.34 AddCreateDelete.pm > --- AddCreateDelete.pm6 Apr 2015 11:07:24 - 1.34 > +++ AddCreateDelete.pm6 Jun 2016 07:09:49 - > @@ -59,25 +59,11 @@ sub handle_options > { > my ($state, $opt_string, @usage) = @_; > > - my $i; > - $state->{opt}{i} //= sub { > - $i++; > - }; > - $state->SUPER::handle_options($opt_string.'IiL:mnx', @usage); > + $state->SUPER::handle_options($opt_string.'L:mnx', @usage); > > $state->progress->setup($state->opt('x'), $state->opt('m'), $state); > $state->{not} = $state->opt('n'); > - if ($state->opt('I')) { > - $i = 0; > - } elsif (!defined $i) { > - $i = -t STDIN; > - } > - if ($i) { > - require OpenBSD::Interactive; > - $state->{interactive} = OpenBSD::Interactive->new($state, $i); > - } else { > - $state->{interactive} = OpenBSD::InteractiveStub->new($state); > - } > + $state->{interactive} //= OpenBSD::InteractiveStub->new($state); > } > > > Index: AddDelete.pm > === > RCS file: /cvs/src/usr.sbin/pkg_add/OpenBSD/AddDelete.pm,v > retrieving revision 1.72 > diff -u -p -r1.72 AddDelete.pm > --- AddDelete.pm 25 May 2015 07:20:31 - 1.72 > +++ AddDelete.pm 6 Jun 2016 07:09:49 - > @@ -167,11 +167,24 @@ sub handle_options > $state->{subst}->add($o, 1); > } > }; > + my $i; > + $state->{opt}{i} //= sub { > + $i++; > + }; > $state->{no_exports} = 1; > $state->SUPER::handle_options($opt_string.'aciInqsB:F:', @usage); > > if ($state->opt('s')) { > $state->{not} = 1; > + } > + if ($state->opt('I')) { > + $i = 0; > + } elsif (!defined $i) { > + $i = -t STDIN; > + } > + if ($i) { > + require OpenBSD::Interactive; > + $state->{interactive} = OpenBSD::Interactive->new($state, $i); > } > # XXX RequiredBy > $main::not = $state->{not}; >
Re: pkg_sign incorrectly assumes -i by default
This should fix things. Index: AddCreateDelete.pm === RCS file: /cvs/src/usr.sbin/pkg_add/OpenBSD/AddCreateDelete.pm,v retrieving revision 1.34 diff -u -p -r1.34 AddCreateDelete.pm --- AddCreateDelete.pm 6 Apr 2015 11:07:24 - 1.34 +++ AddCreateDelete.pm 6 Jun 2016 07:09:49 - @@ -59,25 +59,11 @@ sub handle_options { my ($state, $opt_string, @usage) = @_; - my $i; - $state->{opt}{i} //= sub { - $i++; - }; - $state->SUPER::handle_options($opt_string.'IiL:mnx', @usage); + $state->SUPER::handle_options($opt_string.'L:mnx', @usage); $state->progress->setup($state->opt('x'), $state->opt('m'), $state); $state->{not} = $state->opt('n'); - if ($state->opt('I')) { - $i = 0; - } elsif (!defined $i) { - $i = -t STDIN; - } - if ($i) { - require OpenBSD::Interactive; - $state->{interactive} = OpenBSD::Interactive->new($state, $i); - } else { - $state->{interactive} = OpenBSD::InteractiveStub->new($state); - } + $state->{interactive} //= OpenBSD::InteractiveStub->new($state); } Index: AddDelete.pm === RCS file: /cvs/src/usr.sbin/pkg_add/OpenBSD/AddDelete.pm,v retrieving revision 1.72 diff -u -p -r1.72 AddDelete.pm --- AddDelete.pm25 May 2015 07:20:31 - 1.72 +++ AddDelete.pm6 Jun 2016 07:09:49 - @@ -167,11 +167,24 @@ sub handle_options $state->{subst}->add($o, 1); } }; + my $i; + $state->{opt}{i} //= sub { + $i++; + }; $state->{no_exports} = 1; $state->SUPER::handle_options($opt_string.'aciInqsB:F:', @usage); if ($state->opt('s')) { $state->{not} = 1; + } + if ($state->opt('I')) { + $i = 0; + } elsif (!defined $i) { + $i = -t STDIN; + } + if ($i) { + require OpenBSD::Interactive; + $state->{interactive} = OpenBSD::Interactive->new($state, $i); } # XXX RequiredBy $main::not = $state->{not};
Re: pkg_sign incorrectly assumes -i by default
On Mon, Jun 06, 2016 at 04:14:12PM +1000, Jonathan Gray wrote: > The behaviour of pkg_sign acts as if -i is always specified and won't > sign/resign a package if it exists in the output directory. > > In OpenBSD/PkgSign.pm sign_existing_package $state->opt('i') > path is always taken. Does this come from some shared code > setting a default interactive level for pkg_add's different -i option? > > $ pkg_info -v ./hexedit-1.2.12.tgz > ... > @signer openbsd-60-pkg > @digital-signature > signify:2016-06-05T21:12:25Z:RWQHIajRlT2mX2Co5PKjLtNprvAe8NjNXbxUabL3ySmJfLzFxod5BlCn+RvTB2coDd41rJdPJ+Ob/AUQMeAmEFETgJIVpn5YhAo= > > $ signify -Gn -p test-pkg.pub -s test-pkg.sec > $ doas cp test-pkg.pub /etc/signify/ > > $ pkg_sign -v -D resign -s signify -s test-pkg.sec ./hexedit-1.2.12.tgz > Signed ./hexedit-1.2.12.tgz: ok > $ pkg_info -v ./hexedit-1.2.12.tgz > .. > @signer openbsd-60-pkg > @digital-signature > signify:2016-06-05T21:12:25Z:RWQHIajRlT2mX2Co5PKjLtNprvAe8NjNXbxUabL3ySmJfLzFxod5BlCn+RvTB2coDd41rJdPJ+Ob/AUQMeAmEFETgJIVpn5YhAo= > > $ mkdir out > $ pkg_sign -v -o out -D resign -s signify -s test-pkg.sec ./hexedit-1.2.12.tgz > Resigning hexedit-1.2.12 > Signed ./hexedit-1.2.12.tgz: ok > $ pkg_info -v ./out/hexedit-1.2.12.tgz > .. > @signer test-pkg > @digital-signature > signify:2016-06-06T05:47:46Z:RWRwvf7+8LjZmCFrf65S/RhowUT4+QvgVnEHg4ztH6ZIEVWDVWjlGyd/SWvb1apmxcoaO+lNFm+83OhvvuGsTyEGC95pcA2PTgc= > > $ zfgrep signer ./dtb-4.6.tgz > $ > $ pkg_sign -v -s signify -s test-pkg.sec ./dtb-4.6.tgz > $ zfgrep signer ./dtb-4.6.tgz > $ Yep, definitely inherited that when -i became the default in pkg_add I'm afraid... gonna see to it.