On Tue, Apr 06, 2021 at 08:49:10PM +0200, Marc Espie wrote:
> On Sun, Apr 04, 2021 at 09:56:49PM +0200, Preben Guldberg wrote:
> > Below is a patch that suppresses errors I get when running dpb with -I:
> >
> > Use of uninitialized value $ts in sprintf at
> > /usr/ports/infrastructure/lib/DPB/Util.pm line 58.
> > DPB::Util::ts2string(DPB::Util, <undef>) called at
> > /usr/ports/infrastructure/lib/DPB/Job/Port.pm line 1107
> >
> > DPB::Job::BasePort::timings(DPB::Job::Port::Install=HASH(0xf3c120630d0)(sysutils/iwatch))
> > called at /usr/ports/infrastructure/lib/DPB/Job/Port.pm line 964
> >
> > DPB::Job::BasePort::__ANON__(DPB::Core=HASH(0xf3c1203be38)(localhost:sysutils/iwatch))
> > called at /usr/ports/infrastructure/lib/DPB/Job.pm line 189
> >
> > DPB::Job::Normal::finalize(DPB::Job::Port::Install=HASH(0xf3c120630d0)(sysutils/iwatch),
> > DPB::Core=HASH(0xf3c1203be38)(localhost:sysutils/iwatch)) called at /
> > [... snip - longer example at the end ...]
> >
> > If I run with -P instead of -I, the errors are not seen.
> >
> > The diff at the end avoids a DPB::Util->ts2string($self->{watched}{max})
> > call when $self->{watched} is undefined. My feeling is that the install
> > phase does not watch for stuck processes at all, so it benefits from
> > this.
> >
> > Whether this is the right way or place to address the problem, I don't
> > know, but with the patch the errors are suppressed for me.
>
> Naddy reported something similar.
>
> The actual fix would be somewhat different. Watch is set in an odd location
> in PortBuilder, whereas it should probably be done at the end of
> Job::BasePort->new
>
> (Install could very well get stuck, because install will run build as well
> if the package doesn't already exist, so watched should always be set)
>
> I have a patch for this but I haven't been able to test it yet because my
> dpb boxes are busy with something else.
Previous patch was a brainfart, I had somehow refactored the code in
the wrong base class (e.g., not a base class at all)
Setting a watched uniformously in DPB::Job::BasePort looks like this:
Index: PortBuilder.pm
===================================================================
RCS file: /cvs/ports/infrastructure/lib/DPB/PortBuilder.pm,v
retrieving revision 1.88
diff -u -p -r1.88 PortBuilder.pm
--- PortBuilder.pm 21 Mar 2021 19:17:34 -0000 1.88
+++ PortBuilder.pm 14 Apr 2021 15:19:18 -0000
@@ -255,7 +255,6 @@ sub build
$self->report($v, $job, $core);
&$final_sub($job->{failed});
});
- $job->set_watch($self->logger, $v);
$core->start_job($job, $v);
# lonesome takes precedence for swallowing everything
if ($job->{lonesome}) {
@@ -283,7 +282,6 @@ sub wipe
$self->report($v, $job, $core);
&$final_sub($job->{failed});
});
- $job->set_watch($self->logger, $v);
$core->start_job($job, $v);
}
Index: Job/Port.pm
===================================================================
RCS file: /cvs/ports/infrastructure/lib/DPB/Job/Port.pm,v
retrieving revision 1.204
diff -u -p -r1.204 Port.pm
--- Job/Port.pm 21 Mar 2021 19:17:34 -0000 1.204
+++ Job/Port.pm 14 Apr 2021 15:19:18 -0000
@@ -969,6 +969,7 @@ sub new
$job->{current} = '';
# for stuff that doesn't really lock
$job->{lock} //= DPB::DummyLock->new;
+ $job->set_watch($job->{builder}->logger, $job->{v});
return $job;
}