diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2020-01-09 11:01:26 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2020-01-09 11:01:26 +0000 |
commit | db7cb7aa281530b16e8bc3d03f4c3954fbd51093 (patch) | |
tree | db28c7105cc9ab57e3becff9dfaeb79911ee0ed0 /usr.sbin/pkg_add/OpenBSD | |
parent | a3a80036388055ac6667cff179210d1737425cd2 (diff) |
have ask_tree be more specific in its error reporting.
make sure the child has the same effective and real ids,
as perl interprets it as "setuid, refuse to debug"
go to the end of the pipe so the child doesn't exit
prematurely (didn't use to happen but now it does)
help from afresh1@ in diagnosing that one.
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PkgCreate.pm | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm b/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm index 1feddbc76a0..40c2f106f0f 100644 --- a/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm +++ b/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm @@ -1,6 +1,6 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: PkgCreate.pm,v 1.164 2019/11/07 15:36:51 espie Exp $ +# $OpenBSD: PkgCreate.pm,v 1.165 2020/01/09 11:01:25 espie Exp $ # # Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org> # @@ -990,24 +990,33 @@ sub ask_tree $state->fatal("cannot fork: $!"); } if ($pid == 0) { - # make things debuggable because this child doesn't matter - $DB::inhibit_exit = 0; - chdir $portsdir or exit 2; - open STDERR, ">>", $errors; $ENV{FULLPATH} = 'Yes'; delete $ENV{FLAVOR}; delete $ENV{SUBPACKAGE}; $ENV{SUBDIR} = $pkgpath; $ENV{ECHO_MSG} = ':'; + + if (!chdir $portsdir) { + $state->errsay("Can't chdir #1: #2", $portsdir, $!); + exit(2); + } + open STDERR, ">>", $errors; + # make sure the child starts with a single identity + $( = $); $< = $>; # XXX we're already running as ${BUILD_USER} # so we can't do this again push(@action, 'PORTS_PRIVSEP=No'); + $DB::inhibit_exit = 0; exec $make ('make', @action); } my $plist = OpenBSD::PackingList->read($fh, $data); + while(<$fh>) { # XXX avoid spurious errors from child + } close($fh); if ($? != 0) { - $state->errsay("child failed: #1", $state->child_error); + $state->errsay("child running '#2' failed: #1", + $state->child_error, + join(' ', 'make', @action)); if (open my $fh, '<', $errors) { while(<$fh>) { $state->errprint("#1", $_); |