Re: make release abends with "*** Error code 1"

"Perry E. Metzger" <[email protected]>
Newsgroups gmane.os.netbsd.help
Message-ID <[email protected]>
Woodchuck <[email protected]> writes:
> I suspect mtree, the command that seemed to have most recently
> executed.  A cursory inspection of the source in
> /usr/src/usr.sbin/mtree/mtree.c shows this bit of code near the
> end:
>
> 	status = verify();
> 	if (Uflag & (status == MISMATCHEXIT))
> 		status = 0;
> 	exit(status);
> }
>
> I feel like putting in a spoiler gap here, so that readers could
> try to "spot that bug", but I won't ;-)
>
> Long experience suggests to me that the if statement should read
> 	if (Uflag && (status == MISMATCHEXIT))
> I say that without analyzing the code.

Indeed it should (and I've fixed it in -current), but in fact the code
works just fine. status == MISMATCHEXIT yields a value of 1 (at least
in a standards compliant compiler like gcc), which, when anded bitwise
with 1 (Uflag is 1 or 0), produces the correct result.

Naturally, this is an abuse, which is why I've commited a fix to -current.

However, this is quite clearly not causing you a problem -- my
alteration is not even going to change the execution behavior.

> I have a sense of deja-vu about mtree and this particular bug, I
> seem to recall hacking at it many years ago in a different OS.

Perhaps, but that code is NetBSD specific and only a few years old.

Perry
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.