From 2506b7584c169349256b724b2967e588c5d5c4d3 Mon Sep 17 00:00:00 2001 From: Rob Wu Date: Thu, 14 Jan 2021 18:15:12 +0000 Subject: [PATCH] Bug 1680862 - Use fixed cwd in old.configure for m4 includes r=mhentges js/src/aclocal.m4 contains includes starting with `../../`. As explained in https://bugzilla.mozilla.org/show_bug.cgi?id=1680862#c8, m4 will first try to resolve this path relative to the working directory and only if that path doesn't exists, fall back to the location set by `localdir` (from `-I`). The working directory is usually MOZ_OBJDIR, an immediate subdirectory of topsrcdir, so `../../` resolves to a location outside of topsrcdir. Usually, that path does not exist, and m4 falls back to `localdir` that was passed via `-I`. But if that path existed and is incompatible with the current Gecko checkout, then the build will fail (see bug report). To prevent this from happening, this patch fixes the working directory to `localdir`, so that m4 will immediately find the expected file. Differential Revision: https://phabricator.services.mozilla.com/D101500 --- build/moz.configure/old.configure | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build/moz.configure/old.configure b/build/moz.configure/old.configure index 374f75c93427..f1ebd2c35f3b 100644 --- a/build/moz.configure/old.configure +++ b/build/moz.configure/old.configure @@ -215,6 +215,10 @@ def old_configure_for(old_configure_path, extra_env=None): "--localdir=%s" % os.path.dirname(old_configure), old_configure + ".in", ], + # Fix the working directory, so that when m4 is called, that + # includes of relative paths are deterministically resolved + # relative to the directory containing old-configure. + cwd=os.path.dirname(old_configure), env=env, ) except CalledProcessError as exc: