Closed Bug 703930 Opened 13 years ago Closed 13 years ago

Add |set -o errexit| to *makefiles.sh to abort the build on errors rather than just hiding them

Categories

(Firefox Build System :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla11

People

(Reporter: emorley, Assigned: emorley)

Details

Attachments

(1 file)

As suggested by Joey, to avoid typos such as that fixed by bug 698526 slipping through again, we should ensure the *makefiles.sh scripts bail with a non-zero exit code and thus abort the build, if something goes awry. http://www.davidpashley.com/articles/writing-robust-shell-scripts.html says we can do this with |set -e| or |set -o errexit|. I prefer the latter since it's more readable.
Attached patch Patch v1 (deleted) — Splinter Review
|set -o errexit| is set for all scripts from that point onwards, so has to be turned off at the end of allmakefiles.sh, otherwise multiple places in the rest of configure will error out (eg: the |mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null| line shortly after allmakefile.sh is executed, and many more).
Attachment #575716 - Flags: review?(khuey)
Meant to say, deliberately making a typo in services/makefiles.sh with this patch applied, correctly gives: { ../inbound/services/makefiles.sh: line 56: add_FOOmakefiles: command not found *** Fix above errors and then restart with "c:/mozilla-build/python/python.exe c:/mozilla/repos/inbound/build/pymake/pymake/../make.py -f client.mk build" c:\mozilla\repos\inbound\client.mk:315:0: command 'cd . && ../inbound/configure \ || ( echo "*** Fix above errors and then restart with\ \"c:/mozilla-build/python/python.exe c:/mozilla/repos/inbound/build/pymake/pymake/../make.py -f client.mk build\"" && exit 1 )' failed, return code 1 c:\mozilla\repos\inbound\client.mk:327:0: command 'c:/mozilla-build/python/python.exe c:/mozilla/repos/inbound/build/pymake/pymake/../make.py -f ../inbound/client.mk configure' failed, return code 2 c:\mozilla\repos\inbound\client.mk:174:0: command 'c:/mozilla-build/python/python.exe c:/mozilla/repos/inbound/build/pymake/pymake/../make.py -f ../inbound/client.mk realbuild' failed, return code 2 }
Comment on attachment 575716 [details] [diff] [review] Patch v1 Review of attachment 575716 [details] [diff] [review]: ----------------------------------------------------------------- Is this going to make the "people remove a directory from tree but leave it in *-makefiles.sh" case error out?
Attachment #575716 - Flags: review?(khuey) → review+
It shouldn't, since errexit will be turned off at the end of allmakefiles.sh, before configure calls http://mxr.mozilla.org/mozilla-central/source/build/autoconf/acoutput-fast.pl#174 Do you want it to?
I don't really care either way, I was just curious.
Flags: in-testsuite-
Target Milestone: --- → mozilla11
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: