Open Bug 1323018 Opened 8 years ago Updated 2 years ago

mach build leaves turds on the command line

Categories

(Firefox Build System :: General, defect)

defect

Tracking

(firefox53 affected)

Tracking Status
firefox53 --- affected

People

(Reporter: bzbarsky, Unassigned)

References

Details

This has been happening for a while now... I think it may have started around when bug 1315785 was checked in.

When I run "mach build", it will often leave turds on my command line once I'm done executing.  For example, I just ran it, and my prompt looks like this once it's done:

% 64;1;2;6;9;15;18;21;22c64;1;2;6;9;15;18;21;22c64;1;2;6;9;15;18;21;22c64;1;2;6;9;15;18;21;22c64;1;2;6;9;15;18;21;22c64;1;2;6;9;15;18;21;22c64;1;2;6;9;15;18;21;22c64;1;2;6;9;15;18;21;22c64;1;2;6;9;15;18;21;22c64;1;2;6;9;15;18;21;22c64;1;2;6;9;15;18;21;22c64;1;2;6;9;15;18;21;22c64;1;2;6;9;15;18;21;22c64;1;2;6;9;15;18;21;22c64;1;2;6;9;15;18;21;22c64;1;2;6;9;15;18;21;22c64;1;2;6;9;15;18;21;22c

with the caret after all that stuff.

This doesn't happen every time I do a dep build, but I think it's happened every time I've done a clobber.  I haven't taken the time to really experiment much.

Using tcsh as my shell, in case it matters.
This is almost certainly fallout from bug 1315785. That looks like maybe there are bits of escape codes that aren't being interpreted by your terminal? I'm not sure how that happens, but if they're getting mixed in with other build output they could be mishandled somehow.
> That looks like maybe there are bits of escape codes that aren't being interpreted by your terminal?

That is what it looks like to me, yes.  What's confusing is why they're ending up on my shell's stdin!
Workaround is to add -fcolor-diagnostics=auto (Clang) or -fdiagnostics-color=auto (GCC) to CFLAGS and CXXFLAGS in your mozconfig.

bz: can you please provide us with a few more details? GCC or Clang? GNU Make version (`make -v`)?
Building on Mac, so clang.  make version 3.81 (the default one on Mac; it's pretty old).
Clang doesn't "reset" color terminal sequences between newlines (unlike GCC). I reckon that combined with concurrent output from multiple make-invoked processes is causing things to get in a weird state in your terminal. This /might/ be a duplicate of bug 1318044.
Depends on: 1171610
bz: I just submitted a patch in bug 1318044 that I think may fix this (`hg import https://reviewboard-hg.mozilla.org/gecko/rev/60a9e44bbff7420a02f0d3d1e3974d252fb869d0`). Please try it and dupe this bug if it fixes things.
Flags: needinfo?(bzbarsky)
I just tried clobber builds several times in a row and only hit this issue on 2 out of 5.  :(  So it's hard to test whether the patch actually fixes things without doing a bunch of clobbers.  :(
Flags: needinfo?(bzbarsky)
(In reply to Gregory Szorc [:gps] from comment #3)
> Workaround is to add -fcolor-diagnostics=auto (Clang) or
> -fdiagnostics-color=auto (GCC) to CFLAGS and CXXFLAGS in your mozconfig.

Color diagnostics messed up goto-next-error in Emacs compilation buffers. I'm using clang on Fedora 25. I tried '-fcolor-diagnostics=auto' and configure failed trying to compile a C program. '-fdiagnostics-color=auto' is ignore.

I neutered color_cflags() in build/moz.configure/toolchain.configure and the color is gone now.

Can we have a --disable-color-diagnostics flag added to configure?
Flags: needinfo?(gps)
https://groups.google.com/d/msg/mozilla.dev.platform/4rXNO-0Hl14/mWWJNgD_BgAJ documents how to get Emacs to handle colors properly.

Adding a --disable-color-diagnostics (or similar) is probably worth doing because there will always be a long-tail of editors, IDEs, and other tools that don't like the color codes. Please file a new Core :: Build Config bug to request it.
Flags: needinfo?(gps)
Product: Core → Firefox Build System
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.