Bug 221059 - release: scripts/mk-vmimage.sh does not fail on error
Summary: release: scripts/mk-vmimage.sh does not fail on error
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: 10.3-STABLE
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
Depends on:
Reported: 2017-07-28 03:57 UTC by Johannes Jost Meixner
Modified: 2017-07-30 11:26 UTC (History)
1 user (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Johannes Jost Meixner freebsd_committer 2017-07-28 03:57:55 UTC
I'm currently trying to build AMI images, and I've noticed that one of the components of release behaves interestingly:

During `make ec2ami` (more specifically, the cw-ec2 target) Makefile calls out to scripts/mk-vmimage.sh. This script in turn sources its functions from tools/vmimage.subr.

However, if for instance an error is obtained during the `vm_copy_base` phase, the script will continue as if nothing happens, and even end with a return value of 0.

In my case, while trying to copy the "old" image's contents to the "new" image, the file-backed memorydisk was set to 5000M (too small for the packages I added in).

No step in mk-vmimage.sh will actually fail -- especially not the `vm_copy_base` step -- and the new system will end up missing arbitrary files.

Steps to reproduce:

1. in ${EC2CONF}, Set a VMSIZE that is too small to host the base system and all extra packages.

2. make WITH_CLOUDWARE=yes [...] ec2ami
Comment 1 Glen Barber freebsd_committer 2017-07-28 04:24:49 UTC
I think the solution is: "don't do that."
Comment 2 Ed Maste freebsd_committer 2017-07-28 16:04:56 UTC
The script really ought to be checking for errors. We shouldn't have silent failure / broken output from a misconfigured parameter.
Comment 3 Glen Barber freebsd_committer 2017-07-28 16:10:02 UTC
The parameter is not misconfigured in this case.  The value is too small, and the error case (filesystem full) won't be known until it is triggered.
Comment 4 Johannes Jost Meixner freebsd_committer 2017-07-30 11:25:14 UTC
(In reply to Glen Barber from comment #3)
I agree in that it's a user error (in this case, things worked with 2016Q2 packages but not 2017Q2 packages due to growing size).

However, even then, issues could occur (filesystem full, something else in the script breaks, ...) and mk-vmimage.sh would *still* continue trying to upload the broken VM image to EC2.

And it really shouldn't do that.
Comment 5 Johannes Jost Meixner freebsd_committer 2017-07-30 11:26:16 UTC
(In reply to Johannes Jost Meixner from comment #4)
(To clarify, by "filesystem" I mean in this case the physical disk $OBJDIR is on.)