On Sat, 1 Oct 2016, Kartik Agaram wrote:
> >Synopsis: The build process of release(8) fails when I make a change
I think this problem is specific to a bug in the change that was
described.
> Modify /usr/src/bin/ls/ls.c with something non-trivial. I add these
> lines after the local variable declarations inside ls_main():
>
> FILE* f = NULL;
> f = fopen("/tmp/x", "w");
> fclose(f);
Unfortunately, that change makes ls *and* other programs potentially
crash. I'm not going to say why right now because *actually doing that
that debugging* (and not just thinking about) would be a good exercise.
I say "other programs" as ls_main() is pulled into both 'find' and 'ftpd'.
Both 'ls' and 'find' are used in the build, so breaking them like this may
easily result in making the build fail.
> At this point undoing the change also fails. Interposing `make clean`
> also fails. Running `rm -rf /usr/src && rm -rf /usr/obj/*` and trying to
> start from scratch with the cvs command above -- fails with the exact
> same error message above. I've found no better alternative than to
> delete the virtual server and spin up a new one :/
Yes: if you hose your system sufficiently, you may need to reinstall.
I've lost count of how many times I've had to do that...in a single day!
In this case, I would expect simply reinstalling base##.tgz would have
brought the system back to a workable state.
> That failed as well, but I surmised that perhaps the output of `ls` was
> being used in the build process somewhere.
Correct: the openbsd build depends on *many* utilities in the base system.
A grep -w for 'ls' in the Makefiles find dozens of hits, including in
gcc3, texinfo, llvm, and many sys/arch/*/stand/ subdirectories.
> I can't think of why a random write to /tmp would trip anything up. If
> it's forbidden by pledge() the error should be something related to the
> write, right?)
See explanation above. :-)
> Is the process for building a release what everyone uses for hacking on
> OpenBSD?
Yes.
The challenge for you is how you would diagnose the problem yourself.
The compiler is reporting an error: did you examine the input files for
correctness? Compare the system includes to those from the install tgz
files? Figuring out and understanding *exactly* how the bug you created
would cause that failure would be a good
Philip Guenther