Closed Bug 1031129 Opened 6 years ago Closed 6 years ago

ObjdirMismatchException logic can never trigger the exception for m-c

Categories

(Firefox Build System :: General, defect)

x86_64
Linux
defect
Not set

Tracking

(Not tracked)

RESOLVED FIXED
mozilla33

People

(Reporter: glandium, Assigned: glandium)

Details

Attachments

(1 file)

The logic to throw an ObjdirMismatchException in python/mach/mach/base.py is the following:

            if not samepath(topobjdir, config_topobjdir) \
                and (os.path.exists(mozilla_dir) and not samepath(topobjdir,
                mozilla_dir)):
                raise ...

Let's say A = samepath(topobjdir, config_topobjdir), B = os.path.exists(mozilla_dir), C = samepath(topobjdir, mozilla_dir)
We have the following logic table:
A   B   C   not A and (B and not C)
0   0   0   0
0   0   1   0
0   1   0   1
0   1   1   0
1   0   0   0
1   0   1   0
1   1   0   0
1   1   1   0

In other words, the exception is only thrown when topobjdir is neither mozilla_dir nor config_topobjdir *and* mozilla_dir exists.

What we really want is essentially not A and not C. But C actually throws if B is false (samepath doing os.stat on both paths).
So the table of cases looks like this:
A   B   C   ?
0   0   0   throw
0   0   1   throw
0   1   0   throw
0   1   1   pass
1   0   0   pass
1   0   1   pass
1   1   0   pass
1   1   1   pass

That is, not A and (not B or not C).
Attachment #8446947 - Flags: review?(gps) → review+
https://hg.mozilla.org/mozilla-central/rev/e1e163c94852
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla33
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.